Documentation
¶
Index ¶
- Constants
- Variables
- func RandomDecoyURL() string
- func TunnelDir(tag string) string
- type BackendConfig
- type Config
- func (c *Config) AddTunnel(t TunnelConfig)
- func (c *Config) AddUser(u UserConfig)
- func (c *Config) GetBackend(tag string) *BackendConfig
- func (c *Config) GetTunnel(tag string) *TunnelConfig
- func (c *Config) GetUser(username string) *UserConfig
- func (c *Config) NextAvailablePort() int
- func (c *Config) RemoveTunnel(tag string) bool
- func (c *Config) RemoveUser(username string) bool
- func (c *Config) Save() error
- func (c *Config) SaveTo(path string) error
- func (c *Config) UpdateTunnel(t TunnelConfig)
- func (c *Config) Validate() error
- func (c *Config) ValidateNewTunnel(t *TunnelConfig) error
- type DNSTTConfig
- type ListenConfig
- type NaiveConfig
- type RouteConfig
- type SOCKSConfig
- type SlipstreamConfig
- type TunnelConfig
- type UserConfig
Constants ¶
const ( BackendSOCKS = "socks" BackendSSH = "ssh" )
Backend types.
const ( DefaultConfigDir = "/etc/slipgate" DefaultConfigFile = "/etc/slipgate/config.json" DefaultTunnelDir = "/etc/slipgate/tunnels" DefaultBinDir = "/usr/local/bin" SystemUser = "slipgate" SystemGroup = "slipgate" SSHGroup = "slipgate-ssh" )
const ( TransportDNSTT = "dnstt" TransportSlipstream = "slipstream" TransportNaive = "naive" TransportSSH = "direct-ssh" TransportSOCKS = "direct-socks5" )
Transport types.
const BasePort = 5310
BasePort is the starting port for DNS tunnel forwarding.
const DefaultMTU = 1232
DefaultMTU for DNS tunnels.
Variables ¶
var TransportBinaries = map[string]string{
TransportDNSTT: "dnstt-server",
TransportSlipstream: "slipstream-server",
TransportNaive: "caddy-naive",
}
TransportBinaries maps transport types to their required binaries.
Functions ¶
Types ¶
type BackendConfig ¶
type BackendConfig struct {
Tag string `json:"tag"`
Type string `json:"type"`
Address string `json:"address"`
SOCKS *SOCKSConfig `json:"socks,omitempty"`
}
BackendConfig defines a backend service.
func DefaultBackends ¶
func DefaultBackends() []BackendConfig
DefaultBackends returns the standard backend configs.
type Config ¶
type Config struct {
Listen ListenConfig `json:"listen"`
Tunnels []TunnelConfig `json:"tunnels"`
Backends []BackendConfig `json:"backends"`
Users []UserConfig `json:"users,omitempty"`
Route RouteConfig `json:"route"`
// contains filtered or unexported fields
}
Config is the top-level slipgate configuration.
func (*Config) AddTunnel ¶
func (c *Config) AddTunnel(t TunnelConfig)
AddTunnel adds a tunnel to the config.
func (*Config) GetBackend ¶
func (c *Config) GetBackend(tag string) *BackendConfig
GetBackend returns a backend by tag.
func (*Config) GetTunnel ¶
func (c *Config) GetTunnel(tag string) *TunnelConfig
GetTunnel returns a tunnel by tag.
func (*Config) GetUser ¶
func (c *Config) GetUser(username string) *UserConfig
GetUser returns a user by username.
func (*Config) NextAvailablePort ¶
NextAvailablePort returns the next unused port starting from BasePort.
func (*Config) RemoveTunnel ¶
RemoveTunnel removes a tunnel by tag.
func (*Config) RemoveUser ¶
RemoveUser removes a user by username.
func (*Config) UpdateTunnel ¶
func (c *Config) UpdateTunnel(t TunnelConfig)
UpdateTunnel replaces a tunnel config by tag.
func (*Config) ValidateNewTunnel ¶
func (c *Config) ValidateNewTunnel(t *TunnelConfig) error
ValidateNewTunnel checks a tunnel against the existing config.
type DNSTTConfig ¶
type DNSTTConfig struct {
MTU int `json:"mtu"`
PrivateKey string `json:"private_key"` // path to key file
PublicKey string `json:"public_key"` // hex-encoded public key
}
DNSTTConfig holds config for DNSTT transport (serves both DNSTT and NoizDNS clients).
type ListenConfig ¶
type ListenConfig struct {
Address string `json:"address"`
}
ListenConfig defines the DNS listen address.
type NaiveConfig ¶
type NaiveConfig struct {
Email string `json:"email"`
DecoyURL string `json:"decoy_url"`
Port int `json:"port"` // typically 443
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
}
NaiveConfig holds config for naiveproxy transport.
type RouteConfig ¶
type RouteConfig struct {
Mode string `json:"mode"` // "single" or "multi"
Active string `json:"active"` // active tunnel tag (single mode)
Default string `json:"default"` // default tunnel tag (multi mode fallback)
}
RouteConfig defines routing behavior.
type SOCKSConfig ¶
type SOCKSConfig struct {
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
}
SOCKSConfig holds SOCKS-specific settings.
type SlipstreamConfig ¶
type SlipstreamConfig struct {
Cert string `json:"cert"` // path to cert file
Key string `json:"key"` // path to key file
}
SlipstreamConfig holds config for slipstream transport.
type TunnelConfig ¶
type TunnelConfig struct {
Tag string `json:"tag"`
Transport string `json:"transport"`
Backend string `json:"backend"`
Domain string `json:"domain"`
Port int `json:"port,omitempty"` // DNS tunnels: internal forwarding port (5310+)
Enabled bool `json:"enabled"`
// Transport-specific configs (only one set per tunnel)
DNSTT *DNSTTConfig `json:"dnstt,omitempty"`
Slipstream *SlipstreamConfig `json:"slipstream,omitempty"`
Naive *NaiveConfig `json:"naive,omitempty"`
}
TunnelConfig defines a single tunnel.
func (*TunnelConfig) IsDNSTunnel ¶
func (t *TunnelConfig) IsDNSTunnel() bool
IsDNSTunnel returns true if the transport uses DNS port 53.
func (*TunnelConfig) IsDirectTransport ¶
func (t *TunnelConfig) IsDirectTransport() bool
IsDirectTransport returns true for transports that expose a service directly (no tunnel).
type UserConfig ¶
UserConfig tracks a managed user (same credentials for SSH + SOCKS).