mirror of
https://github.com/alireza0/s-ui.git
synced 2026-10-21 11:22:26 +00:00
Re-sync core/protocol/* from upstream (they were verbatim copies), re-fork core/box.go onto the new upstream box.go, and adapt to changed APIs: - adapter.ConnectionTracker gained RoutedFlow; add no-op impls to both trackers - log.ObservableFactory gained AttachPlatformWriter; add no-op impl - box.Context now takes a CertificateProviderRegistry; wire one up with the origin_ca provider - box.go now depends on debug*.go; copy them from upstream - hysteria inbound moved QUIC option building into quic.go; copy it Deps: sing v0.9.0-beta.4, sing-quic v0.7.0-beta.4, sing-tun v0.9.0-beta.2. Runtime behaviour is not yet validated and config migration for options deprecated in 1.14 is not done, so this is not ready for main.
36 lines
890 B
Go
36 lines
890 B
Go
package core
|
|
|
|
import (
|
|
"runtime/debug"
|
|
|
|
"github.com/sagernet/sing-box/option"
|
|
E "github.com/sagernet/sing/common/exceptions"
|
|
)
|
|
|
|
func checkDebugOptions(options option.DebugOptions) error {
|
|
if options.OOMKiller != nil {
|
|
return E.New("legacy oom_killer in debug options is removed, use oom-killer service instead")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func applyDebugOptions(options option.DebugOptions) {
|
|
if options.GCPercent != nil {
|
|
debug.SetGCPercent(*options.GCPercent)
|
|
}
|
|
if options.MaxStack != nil {
|
|
debug.SetMaxStack(*options.MaxStack)
|
|
}
|
|
if options.MaxThreads != nil {
|
|
debug.SetMaxThreads(*options.MaxThreads)
|
|
}
|
|
if options.PanicOnFault != nil {
|
|
debug.SetPanicOnFault(*options.PanicOnFault)
|
|
}
|
|
if options.TraceBack != "" {
|
|
debug.SetTraceback(options.TraceBack)
|
|
}
|
|
if options.MemoryLimit.Value() != 0 {
|
|
debug.SetMemoryLimit(int64(float64(options.MemoryLimit.Value()) / 1.5))
|
|
}
|
|
}
|