clientcfg

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FVersion            = 0  // "17"
	FTunnelType         = 1  // dnstt, sayedns, dnstt_ssh, sayedns_ssh, naive, naive_ssh, ss, slipstream_ssh
	FName               = 2  // profile name
	FDomain             = 3  // tunnel domain
	FResolvers          = 4  // comma-separated "host:port:auth"
	FAuthMode           = 5  // "0" or "1"
	FKeepAlive          = 6  // "5000"
	FCongestionControl  = 7  // "bbr"
	FTCPListenPort      = 8  // "1080"
	FTCPListenHost      = 9  // "127.0.0.1"
	FGSOEnabled         = 10 // "0"
	FPublicKey          = 11 // hex-encoded Curve25519 public key
	FSOCKSUser          = 12 // SOCKS5 username
	FSOCKSPass          = 13 // SOCKS5 password
	FSSHEnabled         = 14 // "0" or "1"
	FSSHUser            = 15 // SSH username
	FSSHPass            = 16 // SSH password
	FSSHPort            = 17 // "22"
	FFwdDNSThroughSSH   = 18 // "0" (deprecated)
	FSSHHost            = 19 // SSH host address
	FUseServerDNS       = 20 // "0" (deprecated)
	FDoHURL             = 21 // DoH URL
	FDNSTransport       = 22 // "udp"
	FSSHAuthType        = 23 // "password"
	FSSHPrivateKey      = 24 // base64-encoded
	FSSHKeyPassphrase   = 25 // base64-encoded
	FTorBridgeLines     = 26 // base64-encoded
	FDNSTTAuthoritative = 27 // "0" or "1"
	FNaivePort          = 28 // "443"
	FNaiveUser          = 29 // NaiveProxy username
	FNaivePass          = 30 // NaiveProxy password (base64)
	FIsLocked           = 31 // "0"
	FLockPasswordHash   = 32 // ""
	FExpirationDate     = 33 // "0"
	FAllowSharing       = 34 // "0"
	FBoundDeviceId      = 35 // ""
	FResolversHidden    = 36 // "0" (v17)
	FHiddenResolvers    = 37 // "" (v17)
	FNoizDNSStealth     = 38 // "0" or "1" (v18)
	FDNSPayloadSize     = 39 // integer (v18)
	FSOCKS5ServerPort   = 40 // integer, default 1080 (v18)
	TotalFields         = 41
)

v17 field positions (pipe-delimited, 38 fields). Matches the SlipNet Android app's ConfigImporter/ConfigExporter.

View Source
const (
	ClientModeDNSTT   = "dnstt"
	ClientModeNoizDNS = "noizdns"
)

Client modes for DNSTT transport (server is the same, client behavior differs).

Variables

View Source
var TunnelTypeMap = map[string]map[string]map[string]string{
	config.TransportDNSTT: {
		ClientModeDNSTT: {
			config.BackendSOCKS: "dnstt",
			config.BackendSSH:   "dnstt_ssh",
		},
		ClientModeNoizDNS: {
			config.BackendSOCKS: "sayedns",
			config.BackendSSH:   "sayedns_ssh",
		},
	},
	config.TransportSlipstream: {
		"": {
			config.BackendSOCKS: "ss",
			config.BackendSSH:   "slipstream_ssh",
		},
	},
	config.TransportNaive: {
		"": {
			config.BackendSOCKS: "naive",
			config.BackendSSH:   "naive_ssh",
		},
	},
	config.TransportSSH: {
		"": {
			config.BackendSSH: "ssh",
		},
	},
	config.TransportSOCKS: {
		"": {
			config.BackendSOCKS: "socks5",
		},
	},
}

TunnelTypeMap maps transport+clientMode+backend to slipnet:// field[1] value.

Functions

func Decode

func Decode(uri string) ([TotalFields]string, error)

Decode parses a slipnet:// URI back into fields.

func Encode

func Encode(fields [TotalFields]string) string

Encode takes fields and produces a slipnet:// URI. Uses standard base64 (not URL-safe) with no padding wrapping, matching the app.

func GenerateURI

func GenerateURI(tunnel *config.TunnelConfig, backend *config.BackendConfig, cfg *config.Config, opts URIOptions) (string, error)

GenerateURI builds a slipnet:// URI from tunnel + backend config.

func GetTunnelType

func GetTunnelType(transport, backend, clientMode string) string

GetTunnelType returns the slipnet:// type string.

Types

type URIOptions

type URIOptions struct {
	ClientMode string // "dnstt" or "noizdns" (DNSTT transport only)
	Username   string // override SOCKS/SSH username
	Password   string // override SOCKS/SSH password
}

URIOptions controls URI generation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL