config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server          []*ServerConfig `yaml:"server,omitempty" json:"server,omitempty"`
	Local           *LocalConfig    `yaml:"local,omitempty" json:"local,omitempty"`
	Log             *LogConfig      `yaml:"log,omitempty" json:"log,omitempty"`
	Iface           string          `yaml:"iface,omitempty" json:"iface,omitempty"`
	AutoDetectIface bool            `yaml:"auto_detect_iface,omitempty" json:"auto_detect_iface,omitempty"`
	Rules           *Rules          `yaml:"rules,omitempty" json:"rules,omitempty"`
}

func ParseConfigFile

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

func (*Config) BuildLocalOptions

func (cfg *Config) BuildLocalOptions() []ss.SSOption

func (*Config) BuildRuler

func (cfg *Config) BuildRuler() *rule.Ruler

func (*Config) BuildSSLocalOptions

func (cfg *Config) BuildSSLocalOptions() []ss.SSOption

func (*Config) BuildServerOptions

func (cfg *Config) BuildServerOptions() []ss.SSOption

func (*Config) DeleteServerConfig

func (cfg *Config) DeleteServerConfig(name string)

type DnsOption added in v1.0.0

type DnsOption struct {
	Listen         string   `yaml:"listen" json:"listen"`
	DomainFilter   []string `yaml:"domain_filter" json:"domain_filter"`
	Nameservers    []string `yaml:"nameservers" json:"nameservers"`
	DisableRewrite bool     `yaml:"disable_rewrite" json:"disable_rewrite"`
}

type Domain

type Domain struct {
	Proxy  string   `yaml:"proxy" json:"proxy"`
	Action string   `yaml:"action" json:"action"`
	Value  []string `yaml:"value" json:"value"`
}

type DomainKeyword

type DomainKeyword struct {
	Proxy  string   `yaml:"proxy" json:"proxy"`
	Action string   `yaml:"action" json:"action"`
	Value  []string `yaml:"value" json:"value"`
}

type DomainSuffix

type DomainSuffix struct {
	Proxy  string   `yaml:"proxy" json:"proxy"`
	Action string   `yaml:"action" json:"action"`
	Value  []string `yaml:"value" json:"value"`
}

type GeoIP

type GeoIP struct {
	Resolve bool     `yaml:"resolve,omitempty" json:"resolve,omitempty"`
	Proxy   string   `yaml:"proxy" json:"proxy"`
	Action  string   `yaml:"action" json:"action"`
	Value   []string `yaml:"value" json:"value"`
}

type GrpcOption

type GrpcOption struct {
	SendBufferSize int       `yaml:"send_buffer_size,omitempty" json:"send_buffer_size,omitempty"`
	RecvBufferSize int       `yaml:"receive_buffer_size,omitempty" json:"receive_buffer_size,omitempty"`
	TLS            TlsOption `yaml:"tls,omitempty" json:"tls,omitempty"`
}

type IPCidr

type IPCidr struct {
	Resolve bool     `yaml:"resolve,omitempty" json:"resolve,omitempty"`
	Proxy   string   `yaml:"proxy" json:"proxy"`
	Action  string   `yaml:"action" json:"action"`
	Value   []string `yaml:"value" json:"value"`
}

type LocalConfig

type LocalConfig struct {
	SocksAddr   string      `yaml:"socks_addr,omitempty" json:"socks_addr,omitempty"`
	HTTPAddr    string      `yaml:"http_addr,omitempty" json:"http_addr,omitempty"`
	SocksAuth   string      `yaml:"socks_auth,omitempty" json:"socks_auth,omitempty"`
	HTTPAuth    string      `yaml:"http_auth,omitempty" json:"http_auth,omitempty"`
	MixedAddr   string      `yaml:"mixed_addr,omitempty" json:"mixed_addr,omitempty"`
	TCPTunAddr  []string    `yaml:"tcp_tun_addr,omitempty" json:"tcp_tun_addr,omitempty"`
	SystemProxy bool        `yaml:"system_proxy,omitempty" json:"system_proxy,omitempty"`
	Mitm        *MitmOption `yaml:"mitm,omitempty" json:"mitm,omitempty"`
	Tun         *TunOption  `yaml:"tun,omitempty" json:"tun,omitempty"`
	DNS         *DnsOption  `yaml:"dns,omitempty" json:"dns,omitempty"`
}

type LogConfig

type LogConfig struct {
	Color        bool   `yaml:"color,omitempty" json:"color,omitempty"`
	LogLevel     string `yaml:"log_level,omitempty" json:"log_level,omitempty"`
	VerboseLevel int    `yaml:"verbose_level,omitempty" json:"verbose_level,omitempty"`
}

type Match

type Match struct {
	Others         string           `yaml:"others,omitempty" json:"others,omitempty"`
	Domains        []*Domain        `yaml:"domain,omitempty" json:"domain,omitempty"`
	DomainKeywords []*DomainKeyword `yaml:"domain_keyword,omitempty" json:"domain_keyword,omitempty"`
	DomainSuffixs  []*DomainSuffix  `yaml:"domain_suffix,omitempty" json:"domain_suffix,omitempty"`
	GeoIPs         []*GeoIP         `yaml:"geoip,omitempty" json:"geoip,omitempty"`
	IPCidrs        []*IPCidr        `yaml:"ipcidr,omitempty" json:"ipcidr,omitempty"`
}

type MitmFakeCertPool

type MitmFakeCertPool struct {
	Capacity     int `yaml:"capacity" json:"capacity"`
	Interval     int `yaml:"interval" json:"interval"`
	ExpireSecond int `yaml:"expire_second" json:"expire_second"`
}

type MitmOption

type MitmOption struct {
	Enable       bool              `yaml:"enable" json:"enable"`
	Proxy        string            `yaml:"proxy" json:"proxy"`
	CAPath       string            `yaml:"ca_path" json:"ca_path"`
	KeyPath      string            `yaml:"key_path" json:"key_path"`
	FakeCertPool *MitmFakeCertPool `yaml:"fake_cert_pool" json:"fake_cert_pool"`
}

type ObfsOption

type ObfsOption struct {
	Host string `yaml:"host,omitempty" json:"host,omitempty"`
}

type QuicOption

type QuicOption struct {
	Conns                int       `yaml:"conns" json:"conns"`
	KeepAlive            int       `yaml:"keep_alive" json:"keep_alive"`
	MaxIdleTimeout       int       `yaml:"max_idle_timeout" json:"max_idle_timeout"`
	HandshakeIdleTimeout int       `yaml:"handshake_idle_timeout" json:"handshake_idle_timeout"`
	TLS                  TlsOption `yaml:"tls,omitempty" json:"tls,omitempty"`
}

type Rules

type Rules struct {
	Mode     string `yaml:"mode" json:"mode"`
	DirectTo string `yaml:"direct_to,omitempty" json:"direct_to,omitempty"`
	GlobalTo string `yaml:"global_to,omitempty" json:"global_to,omitempty"`
	Match    *Match `yaml:"match,omitempty" json:"match,omitempty"`
}

type SSROption

type SSROption struct {
	Protocol      string `yaml:"protocol" json:"protocol"`
	ProtocolParam string `yaml:"protocol_param,omitempty" json:"protocol_param,omitempty"`
	Obfs          string `yaml:"obfs" json:"obfs"`
	ObfsParam     string `yaml:"obfs_param,omitempty" json:"obfs_param,omitempty"`
}

type ServerConfig

type ServerConfig struct {
	Disable   bool        `yaml:"disable,omitempty" json:"disable,omitempty"`
	Type      string      `yaml:"type,omitempty" json:"type,omitempty"`
	Name      string      `yaml:"name" json:"name"`
	Addr      string      `yaml:"addr" json:"addr"`
	Password  string      `yaml:"password" json:"password"`
	Method    string      `yaml:"method" json:"method"`
	Transport string      `yaml:"transport" json:"transport"`
	Udp       bool        `yaml:"udp,omitempty" json:"udp,omitempty"`
	Ws        *WsOption   `yaml:"ws,omitempty" json:"ws,omitempty"`
	Obfs      *ObfsOption `yaml:"obfs,omitempty" json:"obfs,omitempty"`
	Quic      *QuicOption `yaml:"quic,omitempty" json:"quic,omitempty"`
	Grpc      *GrpcOption `yaml:"grpc,omitempty" json:"grpc,omitempty"`
	Ssh       *SshOption  `yaml:"ssh,omitempty" json:"ssh,omitempty"`
	SSR       *SSROption  `yaml:"ssr,omitempty" json:"ssr,omitempty"`
}

type SshOption added in v1.1.1

type SshOption struct {
	User          string `yaml:"user" json:"user"`
	Password      string `yaml:"password" json:"password"`
	PrivateKey    string `yaml:"private_key" json:"private_key"`
	PublicKey     string `yaml:"public_key" json:"public_key"`
	AuthorizedKey string `yaml:"authorized_key" json:"authorized_key"`
}

type TlsOption

type TlsOption struct {
	// tls or mtls
	Mode     string `yaml:"mode,omitempty" json:"mode,omitempty"`
	Hostname string `yaml:"hostname,omitempty" json:"hostname,omitempty"`
	KeyPath  string `yaml:"key_path,omitempty" json:"key_path,omitempty"`
	CertPath string `yaml:"cert_path,omitempty" json:"cert_path,omitempty"`
	CAPath   string `yaml:"ca_path,omitempty" json:"ca_path,omitempty"`
}

type TunOption

type TunOption struct {
	Enable    bool     `yaml:"enable" json:"enable"`
	Name      string   `yaml:"name" json:"name"`
	Cidr      string   `yaml:"cidr" json:"cidr"`
	Mtu       int      `yaml:"mtu" json:"mtu"`
	AutoRoute bool     `yaml:"auto_route" json:"auto_route"`
	DnsHijack []string `yaml:"dns_hijack,omitempty" json:"dns_hijack,omitempty"`
}

type WsOption

type WsOption struct {
	Path     string    `yaml:"path" json:"path"`
	Host     string    `yaml:"host,omitempty" json:"host,omitempty"`
	Compress bool      `yaml:"compress,omitempty" json:"compress,omitempty"`
	TLS      TlsOption `yaml:"tls,omitempty" json:"tls,omitempty"`
}

Jump to

Keyboard shortcuts

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