Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthPolicy ¶ added in v0.9.0
type AuthPolicy struct {
ID string `toml:"id"`
Users []string `toml:"users,omitempty"` // allowed user IDs (passkey login)
// Header overrides the identity header name (default x-Gatecrash-User).
Header string `toml:"header,omitempty"`
// SecretHash is the bcrypt hash of a machine-generated service secret for
// non-interactive clients (CI, scripts, webhooks). It is generated server-side
// and shown once. Clients send it as the HTTP Basic password — by convention
// with the username "service" (the username is not checked). A service secret
// grants access INDEPENDENT of the Users list, so it is for trusted automation.
SecretHash string `toml:"secret_hash,omitempty"`
}
AuthPolicy is a reusable authentication requirement that tunnels can share. A request authenticates if it is a logged-in user in Users, OR (optionally) it presents the machine-generated service secret via HTTP Basic.
type Config ¶
type Config struct {
Server ServerConfig `toml:"server"`
TLS TLSConfig `toml:"tls"`
Update UpdateConfig `toml:"update"`
Tunnel []Tunnel `toml:"tunnel"`
Redirect []Redirect `toml:"redirect"`
IPPolicy []IPPolicy `toml:"ip_policy"`
AuthPolicy []AuthPolicy `toml:"auth_policy"`
}
func GenerateNew ¶
GenerateNew creates a new Config with auto-generated defaults (random secret, random SSH port, default bind address and cert dir).
func Load ¶
Load reads config from the given path. If the file doesn't exist, it creates a default config with auto-generated values.
func (*Config) AllHostnames ¶
AllHostnames returns all hostnames that need TLS certificates, including tunnel hostnames, admin host, and redirect source hostnames.
func (*Config) CheckIntervalDuration ¶
func (*Config) LookupSecretHash ¶
LookupSecretHash returns the bcrypt hash for a tunnel ID, or "" if not found.
type IPPolicy ¶ added in v0.9.0
type IPPolicy struct {
ID string `toml:"id"`
Ranges []IPRange `toml:"range,omitempty"`
EnrollToken string `toml:"enroll_token,omitempty"`
}
IPPolicy is a reusable source-IP allowlist that tunnels can share. Access is granted to any client in Ranges (permanent) or holding a live self-service grant. EnrollToken, when set, exposes a shareable self-enrollment link.
type IPRange ¶ added in v0.9.0
type IPRange struct {
CIDR string `toml:"cidr" json:"cidr"`
Comment string `toml:"comment,omitempty" json:"comment,omitempty"`
}
IPRange is one entry in an IP policy: a CIDR or single IP with an optional human comment for documentation.
type ServerConfig ¶
type Tunnel ¶
type Tunnel struct {
ID string `toml:"id"`
Type string `toml:"type"`
Hostnames []string `toml:"hostnames,omitempty"`
ListenPort int `toml:"listen_port,omitempty"`
SecretHash string `toml:"secret_hash,omitempty"`
PreserveHost bool `toml:"preserve_host,omitempty"`
TLSPassthrough bool `toml:"tls_passthrough,omitempty"`
// IPPolicy / AuthPolicy reference reusable access policies by ID. They are
// independent gates: when both are set a request must pass both (AND). Auth
// policies apply to HTTP tunnels only.
IPPolicy string `toml:"ip_policy,omitempty"`
AuthPolicy string `toml:"auth_policy,omitempty"`
}
type UpdateConfig ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches a config file for changes and sends validated configs on a channel.
func NewWatcher ¶
NewWatcher creates a new config file watcher.