{"modulePath":"github.com/celzero/firestack","version":"v0.0.0-20261126203528-ea10d50bc2a7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package settings\n\n## Constants\n\n```go\nconst (\n\t// SplitAuto is the default dial strategy; chosen by the engine.\n\tSplitAuto int32 = iota\n\t// SplitTCPOrTLS splits first TCP segment or fragments the TLS SNI header.\n\tSplitTCPOrTLS\n\t// SplitTCP splits the first TCP segment.\n\tSplitTCP\n\t// SplitDesync splits the first TCP segment after desynchronizing the connection\n\t// by sending a different, but fixed, first TCP segement to the censor.\n\tSplitDesync\n\t// SplitNever doesn't muck; connects as-is.\n\tSplitNever\n)\n```\nDial strategies\n\n```go\nconst (\n\t// RetryAfterSplit retries connection as-is after split fails.\n\tRetryAfterSplit int32 = iota\n\t// RetryWithSplit (\"auto\" mode) connects as-is, but retries with split.\n\tRetryWithSplit\n\t// RetryNever never retries.\n\tRetryNever\n)\n```\nRetry strategies\n\n```go\nconst (\n\t// Use among encrypted dns transports wrapped by dnsx.Plus\n\tPlusOrderSafest = iota\n\t// Use dns transports randomly wrapped by dnsx.Plus\n\tPlusOrderRandom\n\t// Prefer faster (p50 latency) dns transports wrapped by dnsx.Plus\n\tPlusOrderFastest\n\t// Prefer working dns transports wrapped by dnsx.Plus\n\tPlusOrderRobust\n)\n```\n\n```go\nconst (\n\t// Use only adblocking transport\n\tPlusFilterNone = iota\n\t// Use only encrypted transport\n\tPlusFilterAdblock\n\tPlusFilterSecurity\n\tPlusFilterFamily\n)\n```\n\n```go\nconst (\n\tNs4  = 0b010 // 2\n\tNs46 = 0b110 // 6\n\tNs6  = 0b100 // 4\n)\n```\nmsb to lsb: ipv6, ipv4, lwip(1) or netstack(0)\n\n```go\nconst (\n\tIP4  = \"4\"\n\tIP46 = \"46\"\n\tIP6  = \"6\"\n)\n```\nIP4, IP46, IP6 are string'd repr of Ns4, Ns46, Ns6\n\n```go\nconst (\n\t// local mode: backend.Auto uses local proxies (ex: ipn.Exit) only.\n\tAutoModeLocal int32 = iota\n\t// remote mode: backend.Auto uses remote proxies (ex: RPN) only.\n\tAutoModeRemote\n\t// hybrid mode: backend.Auto uses local and remote proxies.\n\tAutoModeHybrid\n)\n```\n\n```go\nconst (\n\t// DNSModeNone does not redirect DNS queries sent to the tunnel.\n\tDNSModeNone int32 = 0\n\t// DNSModeIP redirects DNS requests sent to the IP endpoint set by VPN.\n\tDNSModeIP int32 = 1\n\t// DNSModePort redirects all DNS requests on port 53.\n\tDNSModePort int32 = 2\n)\n```\n\n```go\nconst (\n\t// BlockModeNone filters no packet.\n\tBlockModeNone int32 = 0\n\t// BlockModeFilter filters packets on connection establishment.\n\tBlockModeFilter int32 = 1\n\t// BlockModeSink blackholes all packets.\n\tBlockModeSink int32 = 2\n\t// BlockModeFilterProc determines owner-uid of a tcp/udp connection\n\t// from procfs before filtering\n\tBlockModeFilterProc int32 = 3\n)\n```\n\n```go\nconst (\n\t// PtModeAuto does not enforce (but may still use) 6to4 protocol translation.\n\tPtModeAuto int32 = 0\n\t// PtModeForce64 enforces 6to4 protocol translation.\n\tPtModeForce64 int32 = 1\n\t// Android implements 464Xlat out-of-the-box, so this zero userspace impl\n\tPtModeNone int32 = 2\n\t// PtModeForce46 enforces 4 via 6 protocol translation.\n\tPtModeForce46 int32 = 3\n\t// PtModeForce enforces both PtModeForce64 or PtModeForce46.\n\tPtModeForce int32 = 4\n)\n```\n\n```go\nconst AndroidCcUa = \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.32 Safari/537.36\"\n```\nAndroid's default user-agent as set for connectivity checks PROBE\\_HTTPS [https://www.google.com/generate\\_204](https://www.google.com/generate_204) time=183ms ret=204 request={Connection=\\[close], User-Agent=\\[Mozilla/5.0 (X11; Linux x86\\_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.32 Safari/537.36]} headers={null=\\[HTTP/1.1 204 No Content], Alt-Svc=\\[h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000], Connection=\\[close], Content-Length=\\[0], Cross-Origin-Resource-Policy=\\[cross-origin], Date=\\[Fri, 27 Jun 2025 10:56:24 GMT], X-Android-Received-Millis=\\[1751021784573], X-Android-Response-Source=\\[NETWORK 204], X-Android-Selected-Protocol=\\[http/1.1], X-Android-Sent-Millis=\\[1751021784495]} also: android-developers.googleblog.com/2024/12/user-agent-reduction-on-android-webview.html\n\n```go\nconst IntraUa = \"Intra\"\n```\n\n```go\nconst NICID = 0x01\n```\nNICID is the default network interface card ID for the network stack.\n\n## Variables\n\n```go\nvar AutoDialsParallel atomic.Bool\n```\nAutoDialsParallel is a global variable to instruct ipn.Auto proxy to use parallel dialing for all proxies.\n\n```go\nvar AutoMode atomic.Int32\n```\nAutoMode is a global variable to instruct if backend.Auto proxy is in local, remote, or hybrid mode. In local mode, backend.Auto uses local proxies (ex: ipn.Exit) only. In remote mode, backend.Auto uses remote proxies (ex: RPN).\n\n```go\nvar BlockMode atomic.Int32\n```\nBlockMode instructs change in firewall behaviour.\n\n```go\nvar DNSMode atomic.Int32\n```\nDNSMode specifies the kind of DNS traffic to be trapped and routed to DoH servers\n\n```go\nvar Debug bool = false\n```\nDebug is a global flag to enable debug behaviour.\n\n```go\nvar DefaultDNSAsFallback = atomic.Bool{}\n```\nDefaultDNSAsFallback is a global flag to allow using the Default transport as a fallback when the Preferred transport is missing or paused or ended.\n\n```go\nvar EndpointIndependentFiltering = atomic.Bool{}\n```\nEndpointIndependentFiltering is a global flag to enable endpoint-independent filtering for UDP as per RFC 4787.\n\n```go\nvar EndpointIndependentMapping = atomic.Bool{}\n```\nEndpointIndependentMapping is a global flag to enable endpoint-independent mapping for UDP as per RFC 4787.\n\n```go\nvar ExperimentalWireGuard = core.NewForeverFlow(false)\n```\nExperimentalWireGuard is a global flag to enable experimental settings for WireGuard.\n\n```go\nvar FloodWireGuard = atomic.Bool{}\n```\nFloodWireGuard is a global flag to enable flooding WireGuard tunnel with randomly sized non-null packets.\n\n```go\nvar HappyEyeballs = atomic.Bool{}\n```\nHappyEyeballs is a global flag to enable Happy Eyeballs algorithm for dual-stack (IPv4+IPv6) connections.\n\n```go\nvar Loopingback = atomic.Bool{}\n```\nLoopingback is a global flag to adjust netstack behaviour wrt preventing split dialing, closing tunfd without delay etc.\n\n```go\nvar OwnTunFd = atomic.Bool{}\n```\nOwnTunFd is a global flag to indicate that the TUN fd is fully owned by netstack. that is, he TUN FD won't be dup'd and will be closed after use.\n\n```go\nvar PlusFilter = atomic.Int32{}\n```\n\n```go\nvar PlusStrat = atomic.Int32{}\n```\n\n```go\nvar PortForward = atomic.Bool{}\n```\nPortForward is a global flag to enable bound to the same port for the outgoing conn as the incoming sockisfied conn.\n\n```go\nvar PtMode = core.NewForeverFlow(PtModeAuto)\n```\nPtMode determines 6to4 translation heuristics.\n\n```go\nvar SetUserAgent = atomic.Bool{}\n```\nSetUserAgent is a global flag to set User-Agent for DoH requests to \"Intra\" and for HTTP \"Reaches\" checks to the Android default.\n\n```go\nvar SingleThreaded = atomic.Bool{}\n```\nSingleThreaded is a global flag to run Netstack's packet forwarder in a single-threaded mode.\n\n```go\nvar SystemDNSForUndelegatedDomains = atomic.Bool{}\n```\nSystemDNSForUndelegatedDomains is a global flag to always use System DNS for undelegated domains.\n\n```go\nvar WireGuardSearchDomains = atomic.Bool{}\n```\nWireGuardSearchDomains is a global flag to enable the use of search domains for DNS resolution over WireGuard.\n\n## Functions\n\n```go\nfunc AutoActive() bool\n```\nbackend.Auto is effecively not active.\n\n```go\nfunc AutoAlwaysRemote() bool\n```\nbackend.Auto must use remote proxies and never use local (ex: ipn.Exit) ones.\n\n```go\nfunc AutoModeStr() string\n```\n\n```go\nfunc DefaultTunMode()\n```\nDefaultTunMode returns a new default TunMode with IP-only DNS capture and replay (not all DNS traffic but only the DNS traffic sent to \\[tcp/udp]handler.fakedns is captured and replayed to the remote DoH server) and with firewall disabled.\n\n```go\nfunc DupTunFd(yn bool) (prev bool)\n```\nDupTunFd instructs whether the TUN fd should be duplicated (netstack to own a clone of the TUN fd, and will not assume ownership of the TUN fd shared with it).\n\n```go\nfunc Engine(l3 string) int\n```\nEngine returns the engine constant for given l3 string.\n\n```go\nfunc L3(engine int) string\n```\nL3 returns the string'd repr of engine.\n\n```go\nfunc Mode2String(typ string, mode int32) string\n```\nConverts a given DNS/Block/Pt mode to its string representation. typ is one of \"dns\", \"block\", \"pt\"; mode is the value to convert.\n\n```go\nfunc SetAutoDialsParallel(y bool) (prev bool)\n```\nSetAutoDialsParallel puts backend.Auto in parallel-dial mode if y is true. That is, backend.Auto will dial all (available) RPN proxies in parallel.\n\n```go\nfunc SetAutoMode(m int32) (prev int32)\n```\nSetAutoMode sets the global AutoMode variable to m. Indicates if backend.Auto proxy is in local, remote, or hybrid mode.\n\n```go\nfunc SetDialerOpts(strat, retry, sizeBytes, timeoutsec int32, keepalive bool) bool\n```\nSetDialerOpts sets the dialer options to use.\n\n```go\nfunc SetPlusStrategy(ord, filter int) bool\n```\nSetPlusStrategy returns the order strategy for Plus DNS transports.\n\n```go\nfunc SetTunMode(d, b, pt int32)\n```\nSetMode re-assigns d to DNSMode, b to BlockMode, pt to PtMode.\n\n## Types\n\n```go\ntype AutoModeType int32\n```\n\n```go\nfunc (m AutoModeType) String() string\n```\n\n```go\ntype DNSOptions struct {\n\t// contains filtered or unexported fields\n}\n```\nDNSOptions define https or socks5 proxy options\n\n```go\nfunc NewDNSOptions(ipport string) (*DNSOptions, error)\n```\nNewDNSOptions returns a new DNSOpitons object.\n\n```go\nfunc NewDNSOptionsFromHostname(idOrHostOrHostPort, ipOrIPPortCsv string) (*DNSOptions, error)\n```\n\n```go\nfunc NewDNSOptionsFromNetIp(ipp netip.AddrPort) (*DNSOptions, error)\n```\n\n```go\nfunc (d *DNSOptions) AddrPort() string\n```\nAddrPort returns the ip:port or host:port; may return empty string.\n\n```go\nfunc (d *DNSOptions) Port() uint16\n```\n\n```go\nfunc (d *DNSOptions) ResolvedAddrs() string\n```\n\n```go\nfunc (d *DNSOptions) String() string\n```\n\n```go\ntype DialerOpts struct {\n\t// Strat is the dialing strategy.\n\tStrat int32\n\t// Retry is the retry strategy.\n\tRetry int32\n\t// LowerKeepAlive is the flag to enable low TCP keep-alive.\n\t// Currently, 600s for idle, 5s for interval, and 4 probes.\n\tLowerKeepAlive bool\n\t// Read timeout for outgoing tcp \u0026 udp connections.\n\tReadTimeoutSec int32\n\t// Write timeout for outgoing tcp \u0026 udp connections.\n\tWriteTimeoutSec int32\n\t// Write buffer sizes for TCP and UDP\n\tWriteBufferSize int32\n\t// Read buffer sizes for TCP and UDP\n\tReadBufferSize int32\n}\n```\nDialerOpts define dialer options.\n\n```go\nfunc GetDialerOpts() DialerOpts\n```\nGetDialerOpts returns current dialer options.\n\n```go\nfunc (d DialerOpts) String() string\n```\n\n```go\ntype ProxyOptions struct {\n\tAuth   *proxy.Auth\n\tIP     string   // just the ip\n\tHost   string   // just the hostname (no port)\n\tPort   string   // just the port number\n\tIPPort string   // may be a url or ip:port\n\tScheme string   // http, https, socks5, pip\n\tAddrs  []string // list of ips if ipport is a url; may be nil\n}\n```\nProxyOptions define https or socks5 proxy options\n\n```go\nfunc NewAuthProxyOptions(scheme, username, password, ip, port string, addrs []string) *ProxyOptions\n```\nNewAuthProxyOptions returns a new ProxyOptions object with authentication object.\n\n```go\nfunc NewProxyOptions(ip string, port string) *ProxyOptions\n```\nNewProxyOptions returns a new ProxyOptions object.\n\n```go\nfunc (p *ProxyOptions) FullUrl() string\n```\nFullUrl returns the full url with auth.\n\n```go\nfunc (p *ProxyOptions) HasAuth() bool\n```\nHasAuth returns true if p has auth params.\n\n```go\nfunc (p *ProxyOptions) String() string\n```\n\n```go\nfunc (p *ProxyOptions) Url() string\n```\nUrl returns the url without auth.\n\n","path":"github.com/celzero/firestack/intra/settings","name":"settings","synopsis":"","isRedistributable":true}
