conf

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: AGPL-3.0 Imports: 13 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 {
	Inbounds  Inbounds              `json:"inbounds"`
	Outbounds map[string]*ProxyNode `json:"outbounds"`
	Routing   *Routing              `json:"routing"`
	Misc      Misc                  `json:"misc"`
}

func Parse

func Parse(configFilePath string, ruleDBFilePath string) (*Config, error)

type HTTPSOCKS

type HTTPSOCKS struct {
	Host        string `json:"host"`
	Port        uint16 `json:"port"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	SystemProxy bool   `json:"system-proxy"`
}

func (*HTTPSOCKS) ToHTTPSOCKSAuthInfo added in v0.2.1

func (httpSOCKS *HTTPSOCKS) ToHTTPSOCKSAuthInfo() *HTTPSOCKSAuthInfo

func (*HTTPSOCKS) UnmarshalJSON added in v0.2.0

func (httpSOCKS *HTTPSOCKS) UnmarshalJSON(data []byte) error

type HTTPSOCKSAuthInfo added in v0.2.1

type HTTPSOCKSAuthInfo struct {
	Username string
	Password string
}

func (*HTTPSOCKSAuthInfo) IsEmpty added in v0.2.1

func (authInfo *HTTPSOCKSAuthInfo) IsEmpty() bool

func (*HTTPSOCKSAuthInfo) NotEqual added in v0.2.1

func (authInfo *HTTPSOCKSAuthInfo) NotEqual(anotherAuthInfo *HTTPSOCKSAuthInfo) bool

func (*HTTPSOCKSAuthInfo) NotEqual2 added in v0.2.1

func (authInfo *HTTPSOCKSAuthInfo) NotEqual2(username, password string) bool

type HexPassword added in v0.2.2

type HexPassword struct {
	Raw    [16]byte
	String string
}

func (*HexPassword) UnmarshalJSON added in v0.2.2

func (pw *HexPassword) UnmarshalJSON(data []byte) error

type Hg

type Hg struct {
	Host                      string          `json:"host"`
	Password                  HexPassword     `json:"password"`
	TCPPort                   *uint16         `json:"tcp-port"`
	TLSPort                   uint16          `json:"tls-port"`
	TLSCertKeyPair            *TLSCertKeyPair `json:"tls-cert-key-pair"`
	TLSBadAuthFallbackSiteDir string          `json:"tls-bad-auth-fallback-site-dir"`
	QUICPort                  uint16          `json:"quic-port"`
}

func (*Hg) UnmarshalJSON

func (hg *Hg) UnmarshalJSON(data []byte) error

type Inbounds added in v0.2.1

type Inbounds struct {
	HTTPSOCKS *HTTPSOCKS `json:"http-socks"`
	Hg        *Hg        `json:"hg"`
}

type Misc

type Misc struct {
	HgBinaryAutoUpdate  bool   `json:"hg-binary-auto-update"`
	RulesFileAutoUpdate bool   `json:"rules-file-auto-update"`
	TLSKeyLog           bool   `json:"tls-key-log"`
	VerboseLog          bool   `json:"verbose-log"`
	Profiling           bool   `json:"profiling"`
	ProfilingPort       uint16 `json:"profiling-port"`
}

func (*Misc) UnmarshalJSON added in v0.2.1

func (misc *Misc) UnmarshalJSON(data []byte) error

type ProxyNode

type ProxyNode struct {
	Host              string      `json:"host"`
	Password          HexPassword `json:"password"`
	TCPPort           *uint16     `json:"tcp-port"`
	TLSPort           uint16      `json:"tls-port"`
	TLSCustomCertFile string      `json:"tls-cert"`
	QUICPort          uint16      `json:"quic-port"`
}

func (*ProxyNode) UnmarshalJSON

func (node *ProxyNode) UnmarshalJSON(data []byte) error

type Routing added in v0.3.0

type Routing struct {
	Transport Transport `json:"transport"`
	Rules     Rules     `json:"rules"`
	Final     string    `json:"final"`
}

type Rule

type Rule struct {
	Matcher *libRule.Matcher `json:"match"`
	Policy  string           `json:"policy"`
}

type Rules

type Rules []Rule

func (Rules) CopyWithNewRulesData

func (rules Rules) CopyWithNewRulesData(ruleDBFilePath string) (Rules, error)

type TCPTransport added in v0.3.0

type TCPTransport string
const (
	ShadowsocksTransport      TCPTransport = "shadowsocks"
	ShadowsocksTransportAlias TCPTransport = "ss"
	TrojanTransport           TCPTransport = "trojan"
	TrojanTransportAlias      TCPTransport = "tr"
	SunnyQUICTransport        TCPTransport = "sunnyquic"
	SunnyQUICTransportAlias   TCPTransport = "sq"
)

type TLSCertKeyPair

type TLSCertKeyPair struct {
	CertFile string
	KeyFile  string
}

func (*TLSCertKeyPair) UnmarshalJSON

func (pair *TLSCertKeyPair) UnmarshalJSON(data []byte) error

type Transport added in v0.3.0

type Transport struct {
	TCP TCPTransport `json:"tcp"`
	// UDP is not used yet; it will be supported later.
	UDP string `json:"udp"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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