{"modulePath":"github.com/celzero/firestack","version":"v0.0.0-20261126203528-ea10d50bc2a7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package runtime\n\nPackage runtime exposes a curated set of Go runtime internals (secure mode, traceback level, environment variables) that the intra core / tun2socks code needs to control on Android.\n\nIt is split out of intra/core into its own sub-package so that the //go:linkname directives below (which require the final link to be invoked with -checklinkname=0) only affect the final link of the tun2socks binary, not every other binary or test that imports intra/core transitively. Without this split, any package that transitively imports intra/core (which is most of the intra tree) would have to be built with -checklinkname=0 too.\n\nPushing / pulling runtime symbols via //go:linkname works provided the final link uses -ldflags=\"-checklinkname=0\".\n\n## Functions\n\n```go\nfunc GetRuntimeEnviron(key string) (val string, found bool)\n```\nGetRuntimeEnviron gets a value from the Go runtime's cached environment vars.\n\n```go\nfunc RuntimeEnviron() []string\n```\nRuntimeEnviron returns the Go runtime's cached environment vars. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L98\n\n```go\nfunc RuntimeFinishDebugVarsSetup()\n```\nRuntimeFinishDebugVarsSetup resets internal runtime debug variables by re-reading GODEBUG \u0026 GOTRACEBACK env vars. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L462\n\n```go\nfunc RuntimeGotraceback() (l int32, all, crash bool)\n```\nRuntimeGotraceback returns the current GOTRACEBACK settings. github.com/golang/go/blob/e2fef50def98/src/runtime/runtime1.go#L38\n\n```go\nfunc RuntimeResetTracebackEnv() (prev uint32)\n```\ntraceback\\_env is the floor value that setTraceback ORs into every call: traceback\\_env = traceback\\_cache after finishDebugVarsSetup, so it encodes whatever level+crash bits were in force at that point. This makes traceback a one-way ratchet: once the level goes up (e.g. to \"system\"), t |= traceback\\_env prevents it from ever coming back down via a subsequent debug.SetTraceback(\"single\") call. Zeroing it before setTraceback / finishDebugVarsSetup breaks the ratchet so the level can be raised or lowered freely. Must be called before RuntimeFinishDebugVarsSetup / debug.SetTraceback when a lower level than the previously-set one is desired. sample test: go.dev/play/p/VOPFogTh8Ny github.com/golang/go/blob/fed3b0a298/src/runtime/runtime1.go#L27\n\n```go\nfunc RuntimeSecureMode() (them, us bool)\n```\nRuntimeSecureMode reports whether the Go runtime is in secure mode. github.com/golang/go/blob/e2fef50def98/src/runtime/os\\_linux.go#L296\n\n```go\nfunc RuntimeWtf(s string)\n```\nRuntimeWtf uses runtime.writeHeader and emits s to logd. github.com/golang/go/blob/e2fef50def98/src/runtime/write\\_err\\_android.go#L39\n\n```go\nfunc SecureMode(new bool) (prev bool)\n```\n\n```go\nfunc SetRuntimeEnviron(key, val string) (didSet, overwrote bool, err error)\n```\nSetRuntimeEnviron sets / adds a key-value pair in the Go runtime's cached environment vars.\n\n","path":"github.com/celzero/firestack/intra/core/runtime","name":"runtime","synopsis":"Package runtime exposes a curated set of Go runtime internals (secure mode, traceback level, environment variables) that the intra core / tun2socks code needs to control on Android.","isRedistributable":true}
