config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package config handles TOML configuration parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFullSecret

func BuildFullSecret(key []byte, host string) string

BuildFullSecret builds the full secret string: ee + key + hex(host)

func GenerateKey

func GenerateKey() (string, error)

GenerateKey generates a new random 16-byte key (returned as 32 hex chars).

func ParseKey

func ParseKey(s string) ([]byte, error)

ParseKey parses a 16-byte hex-encoded key (32 hex chars).

Types

type Config

type Config struct {
	Secrets  map[string]string `toml:"secrets"` // name = "secret"
	BindTo   string            `toml:"bind-to"`
	LogLevel string            `toml:"log-level"` // trace, debug, info, warn, error

	TLSFronting TLSFrontingConfig `toml:"tls-fronting"`
	Performance PerformanceConfig `toml:"performance"`
}

Config is the TOML configuration structure.

func Load

func Load(path string) (*Config, error)

Load loads configuration from a TOML file.

func (*Config) ToGProxyConfig

func (c *Config) ToGProxyConfig() (gproxy.Config, error)

ToGProxyConfig converts to gproxy.Config.

type Duration

type Duration time.Duration

Duration is a TOML-parseable duration.

func (Duration) Duration

func (d Duration) Duration() time.Duration

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type PerformanceConfig

type PerformanceConfig struct {
	TCPBufferKB   int      `toml:"tcp-buffer-kb"`
	NumEventLoops int      `toml:"num-event-loops"` // gnet event loops (0 = auto, uses all cores)
	PreferIP      string   `toml:"prefer-ip"`
	IdleTimeout   Duration `toml:"idle-timeout"`
}

PerformanceConfig configures performance settings.

type TLSFrontingConfig

type TLSFrontingConfig struct {
	MaskHost string `toml:"mask-host"`
}

TLSFrontingConfig configures TLS fronting.

Jump to

Keyboard shortcuts

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