option

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: GPL-2.0 Imports: 19 Imported by: 170

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DNSQueryTypeToString added in v1.2.0

func DNSQueryTypeToString(queryType uint16) string

func MarshallObjects

func MarshallObjects(objects ...any) ([]byte, error)

func MergeObjects

func MergeObjects(objects ...any) (*badjson.JSONObject, error)

func ToMap

func ToMap(v any) (*badjson.JSONObject, error)

func UnmarshallExcluded

func UnmarshallExcluded(inputContent []byte, parentObject any, object any) error

Types

type ACMEExternalAccountOptions added in v1.0.1

type ACMEExternalAccountOptions struct {
	KeyID  string `json:"key_id,omitempty"`
	MACKey string `json:"mac_key,omitempty"`
}

type BytesLength added in v1.2.0

type BytesLength int64

func (BytesLength) MarshalJSON added in v1.2.0

func (l BytesLength) MarshalJSON() ([]byte, error)

func (*BytesLength) UnmarshalJSON added in v1.2.0

func (l *BytesLength) UnmarshalJSON(bytes []byte) error

type ClashAPIOptions

type ClashAPIOptions struct {
	ExternalController string `json:"external_controller,omitempty"`
	ExternalUI         string `json:"external_ui,omitempty"`
	Secret             string `json:"secret,omitempty"`
	DefaultMode        string `json:"default_mode,omitempty"`
	StoreSelected      bool   `json:"store_selected,omitempty"`
	CacheFile          string `json:"cache_file,omitempty"`
}

type DNSClientOptions

type DNSClientOptions struct {
	Strategy      DomainStrategy `json:"strategy,omitempty"`
	DisableCache  bool           `json:"disable_cache,omitempty"`
	DisableExpire bool           `json:"disable_expire,omitempty"`
}

type DNSOptions

type DNSOptions struct {
	Servers []DNSServerOptions `json:"servers,omitempty"`
	Rules   []DNSRule          `json:"rules,omitempty"`
	Final   string             `json:"final,omitempty"`
	DNSClientOptions
}

type DNSQueryType added in v1.2.0

type DNSQueryType uint16

func (DNSQueryType) MarshalJSON added in v1.2.0

func (t DNSQueryType) MarshalJSON() ([]byte, error)

func (*DNSQueryType) UnmarshalJSON added in v1.2.0

func (t *DNSQueryType) UnmarshalJSON(bytes []byte) error

type DNSRule

type DNSRule _DNSRule

func (DNSRule) MarshalJSON

func (r DNSRule) MarshalJSON() ([]byte, error)

func (*DNSRule) UnmarshalJSON

func (r *DNSRule) UnmarshalJSON(bytes []byte) error

type DNSServerOptions

type DNSServerOptions struct {
	Tag                  string         `json:"tag,omitempty"`
	Address              string         `json:"address"`
	AddressResolver      string         `json:"address_resolver,omitempty"`
	AddressStrategy      DomainStrategy `json:"address_strategy,omitempty"`
	AddressFallbackDelay Duration       `json:"address_fallback_delay,omitempty"`
	Strategy             DomainStrategy `json:"strategy,omitempty"`
	Detour               string         `json:"detour,omitempty"`
}

type DebugOptions added in v1.2.0

type DebugOptions struct {
	GCPercent    *int        `json:"gc_percent,omitempty"`
	MaxStack     *int        `json:"max_stack,omitempty"`
	MaxThreads   *int        `json:"max_threads,omitempty"`
	PanicOnFault *bool       `json:"panic_on_fault,omitempty"`
	TraceBack    string      `json:"trace_back,omitempty"`
	MemoryLimit  BytesLength `json:"memory_limit,omitempty"`
	OOMKiller    *bool       `json:"oom_killer,omitempty"`
}

type DefaultDNSRule

type DefaultDNSRule struct {
	Inbound         Listable[string]       `json:"inbound,omitempty"`
	IPVersion       int                    `json:"ip_version,omitempty"`
	QueryType       Listable[DNSQueryType] `json:"query_type,omitempty"`
	Network         string                 `json:"network,omitempty"`
	AuthUser        Listable[string]       `json:"auth_user,omitempty"`
	Protocol        Listable[string]       `json:"protocol,omitempty"`
	Domain          Listable[string]       `json:"domain,omitempty"`
	DomainSuffix    Listable[string]       `json:"domain_suffix,omitempty"`
	DomainKeyword   Listable[string]       `json:"domain_keyword,omitempty"`
	DomainRegex     Listable[string]       `json:"domain_regex,omitempty"`
	Geosite         Listable[string]       `json:"geosite,omitempty"`
	SourceGeoIP     Listable[string]       `json:"source_geoip,omitempty"`
	SourceIPCIDR    Listable[string]       `json:"source_ip_cidr,omitempty"`
	SourcePort      Listable[uint16]       `json:"source_port,omitempty"`
	SourcePortRange Listable[string]       `json:"source_port_range,omitempty"`
	Port            Listable[uint16]       `json:"port,omitempty"`
	PortRange       Listable[string]       `json:"port_range,omitempty"`
	ProcessName     Listable[string]       `json:"process_name,omitempty"`
	ProcessPath     Listable[string]       `json:"process_path,omitempty"`
	PackageName     Listable[string]       `json:"package_name,omitempty"`
	User            Listable[string]       `json:"user,omitempty"`
	UserID          Listable[int32]        `json:"user_id,omitempty"`
	Outbound        Listable[string]       `json:"outbound,omitempty"`
	ClashMode       string                 `json:"clash_mode,omitempty"`
	Invert          bool                   `json:"invert,omitempty"`
	Server          string                 `json:"server,omitempty"`
	DisableCache    bool                   `json:"disable_cache,omitempty"`
}

func (DefaultDNSRule) IsValid

func (r DefaultDNSRule) IsValid() bool

type DefaultRule

type DefaultRule struct {
	Inbound         Listable[string] `json:"inbound,omitempty"`
	IPVersion       int              `json:"ip_version,omitempty"`
	Network         string           `json:"network,omitempty"`
	AuthUser        Listable[string] `json:"auth_user,omitempty"`
	Protocol        Listable[string] `json:"protocol,omitempty"`
	Domain          Listable[string] `json:"domain,omitempty"`
	DomainSuffix    Listable[string] `json:"domain_suffix,omitempty"`
	DomainKeyword   Listable[string] `json:"domain_keyword,omitempty"`
	DomainRegex     Listable[string] `json:"domain_regex,omitempty"`
	Geosite         Listable[string] `json:"geosite,omitempty"`
	SourceGeoIP     Listable[string] `json:"source_geoip,omitempty"`
	GeoIP           Listable[string] `json:"geoip,omitempty"`
	SourceIPCIDR    Listable[string] `json:"source_ip_cidr,omitempty"`
	IPCIDR          Listable[string] `json:"ip_cidr,omitempty"`
	SourcePort      Listable[uint16] `json:"source_port,omitempty"`
	SourcePortRange Listable[string] `json:"source_port_range,omitempty"`
	Port            Listable[uint16] `json:"port,omitempty"`
	PortRange       Listable[string] `json:"port_range,omitempty"`
	ProcessName     Listable[string] `json:"process_name,omitempty"`
	ProcessPath     Listable[string] `json:"process_path,omitempty"`
	PackageName     Listable[string] `json:"package_name,omitempty"`
	User            Listable[string] `json:"user,omitempty"`
	UserID          Listable[int32]  `json:"user_id,omitempty"`
	ClashMode       string           `json:"clash_mode,omitempty"`
	Invert          bool             `json:"invert,omitempty"`
	Outbound        string           `json:"outbound,omitempty"`
}

func (DefaultRule) IsValid

func (r DefaultRule) IsValid() bool

type DialerOptions

type DialerOptions struct {
	Detour             string         `json:"detour,omitempty"`
	BindInterface      string         `json:"bind_interface,omitempty"`
	Inet4BindAddress   *ListenAddress `json:"inet4_bind_address,omitempty"`
	Inet6BindAddress   *ListenAddress `json:"inet6_bind_address,omitempty"`
	ProtectPath        string         `json:"protect_path,omitempty"`
	RoutingMark        int            `json:"routing_mark,omitempty"`
	ReuseAddr          bool           `json:"reuse_addr,omitempty"`
	ConnectTimeout     Duration       `json:"connect_timeout,omitempty"`
	TCPFastOpen        bool           `json:"tcp_fast_open,omitempty"`
	UDPFragment        *bool          `json:"udp_fragment,omitempty"`
	UDPFragmentDefault bool           `json:"-"`
	DomainStrategy     DomainStrategy `json:"domain_strategy,omitempty"`
	FallbackDelay      Duration       `json:"fallback_delay,omitempty"`
}

type DirectInboundOptions

type DirectInboundOptions struct {
	ListenOptions
	Network         NetworkList `json:"network,omitempty"`
	OverrideAddress string      `json:"override_address,omitempty"`
	OverridePort    uint16      `json:"override_port,omitempty"`
}

type DirectOutboundOptions

type DirectOutboundOptions struct {
	DialerOptions
	OverrideAddress string `json:"override_address,omitempty"`
	OverridePort    uint16 `json:"override_port,omitempty"`
	ProxyProtocol   uint8  `json:"proxy_protocol,omitempty"`
}

type DomainStrategy

type DomainStrategy dns.DomainStrategy

func (DomainStrategy) MarshalJSON

func (s DomainStrategy) MarshalJSON() ([]byte, error)

func (*DomainStrategy) UnmarshalJSON

func (s *DomainStrategy) UnmarshalJSON(bytes []byte) error

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(bytes []byte) error

type ExperimentalOptions

type ExperimentalOptions struct {
	ClashAPI *ClashAPIOptions `json:"clash_api,omitempty"`
	V2RayAPI *V2RayAPIOptions `json:"v2ray_api,omitempty"`
	Debug    *DebugOptions    `json:"debug,omitempty"`
}

type GeoIPOptions

type GeoIPOptions struct {
	Path           string `json:"path,omitempty"`
	DownloadURL    string `json:"download_url,omitempty"`
	DownloadDetour string `json:"download_detour,omitempty"`
}

type GeositeOptions

type GeositeOptions struct {
	Path           string `json:"path,omitempty"`
	DownloadURL    string `json:"download_url,omitempty"`
	DownloadDetour string `json:"download_detour,omitempty"`
}

type HTTPMixedInboundOptions

type HTTPMixedInboundOptions struct {
	ListenOptions
	Users          []auth.User        `json:"users,omitempty"`
	SetSystemProxy bool               `json:"set_system_proxy,omitempty"`
	TLS            *InboundTLSOptions `json:"tls,omitempty"`
}

type HTTPOutboundOptions

type HTTPOutboundOptions struct {
	DialerOptions
	ServerOptions
	Username string              `json:"username,omitempty"`
	Password string              `json:"password,omitempty"`
	TLS      *OutboundTLSOptions `json:"tls,omitempty"`
}

type HTTPProxyOptions added in v1.2.0

type HTTPProxyOptions struct {
	Enabled bool `json:"enabled,omitempty"`
	ServerOptions
}

type HysteriaInboundOptions added in v1.0.1

type HysteriaInboundOptions struct {
	ListenOptions
	Up                  string             `json:"up,omitempty"`
	UpMbps              int                `json:"up_mbps,omitempty"`
	Down                string             `json:"down,omitempty"`
	DownMbps            int                `json:"down_mbps,omitempty"`
	Obfs                string             `json:"obfs,omitempty"`
	Users               []HysteriaUser     `json:"users,omitempty"`
	ReceiveWindowConn   uint64             `json:"recv_window_conn,omitempty"`
	ReceiveWindowClient uint64             `json:"recv_window_client,omitempty"`
	MaxConnClient       int                `json:"max_conn_client,omitempty"`
	DisableMTUDiscovery bool               `json:"disable_mtu_discovery,omitempty"`
	TLS                 *InboundTLSOptions `json:"tls,omitempty"`
}

type HysteriaOutboundOptions added in v1.0.1

type HysteriaOutboundOptions struct {
	DialerOptions
	ServerOptions
	Up                  string              `json:"up,omitempty"`
	UpMbps              int                 `json:"up_mbps,omitempty"`
	Down                string              `json:"down,omitempty"`
	DownMbps            int                 `json:"down_mbps,omitempty"`
	Obfs                string              `json:"obfs,omitempty"`
	Auth                []byte              `json:"auth,omitempty"`
	AuthString          string              `json:"auth_str,omitempty"`
	ReceiveWindowConn   uint64              `json:"recv_window_conn,omitempty"`
	ReceiveWindow       uint64              `json:"recv_window,omitempty"`
	DisableMTUDiscovery bool                `json:"disable_mtu_discovery,omitempty"`
	Network             NetworkList         `json:"network,omitempty"`
	TLS                 *OutboundTLSOptions `json:"tls,omitempty"`
}

type HysteriaUser added in v1.1.0

type HysteriaUser struct {
	Name       string `json:"name,omitempty"`
	Auth       []byte `json:"auth,omitempty"`
	AuthString string `json:"auth_str,omitempty"`
}

type Inbound

type Inbound _Inbound

func (Inbound) MarshalJSON

func (h Inbound) MarshalJSON() ([]byte, error)

func (*Inbound) UnmarshalJSON

func (h *Inbound) UnmarshalJSON(bytes []byte) error

type InboundACMEOptions added in v1.0.1

type InboundACMEOptions struct {
	Domain                  Listable[string]            `json:"domain,omitempty"`
	DataDirectory           string                      `json:"data_directory,omitempty"`
	DefaultServerName       string                      `json:"default_server_name,omitempty"`
	Email                   string                      `json:"email,omitempty"`
	Provider                string                      `json:"provider,omitempty"`
	DisableHTTPChallenge    bool                        `json:"disable_http_challenge,omitempty"`
	DisableTLSALPNChallenge bool                        `json:"disable_tls_alpn_challenge,omitempty"`
	AlternativeHTTPPort     uint16                      `json:"alternative_http_port,omitempty"`
	AlternativeTLSPort      uint16                      `json:"alternative_tls_port,omitempty"`
	ExternalAccount         *ACMEExternalAccountOptions `json:"external_account,omitempty"`
}

type InboundOptions

type InboundOptions struct {
	SniffEnabled             bool           `json:"sniff,omitempty"`
	SniffOverrideDestination bool           `json:"sniff_override_destination,omitempty"`
	SniffTimeout             Duration       `json:"sniff_timeout,omitempty"`
	DomainStrategy           DomainStrategy `json:"domain_strategy,omitempty"`
}

type InboundRealityHandshakeOptions added in v1.2.0

type InboundRealityHandshakeOptions struct {
	ServerOptions
	DialerOptions
}

type InboundRealityOptions added in v1.2.0

type InboundRealityOptions struct {
	Enabled           bool                           `json:"enabled,omitempty"`
	Handshake         InboundRealityHandshakeOptions `json:"handshake,omitempty"`
	PrivateKey        string                         `json:"private_key,omitempty"`
	ShortID           Listable[string]               `json:"short_id,omitempty"`
	MaxTimeDifference Duration                       `json:"max_time_difference,omitempty"`
}

type InboundTLSOptions

type InboundTLSOptions struct {
	Enabled         bool                   `json:"enabled,omitempty"`
	ServerName      string                 `json:"server_name,omitempty"`
	Insecure        bool                   `json:"insecure,omitempty"`
	ALPN            Listable[string]       `json:"alpn,omitempty"`
	MinVersion      string                 `json:"min_version,omitempty"`
	MaxVersion      string                 `json:"max_version,omitempty"`
	CipherSuites    Listable[string]       `json:"cipher_suites,omitempty"`
	Certificate     string                 `json:"certificate,omitempty"`
	CertificatePath string                 `json:"certificate_path,omitempty"`
	Key             string                 `json:"key,omitempty"`
	KeyPath         string                 `json:"key_path,omitempty"`
	ACME            *InboundACMEOptions    `json:"acme,omitempty"`
	Reality         *InboundRealityOptions `json:"reality,omitempty"`
}

type Listable

type Listable[T comparable] []T

func (Listable[T]) MarshalJSON

func (l Listable[T]) MarshalJSON() ([]byte, error)

func (*Listable[T]) UnmarshalJSON

func (l *Listable[T]) UnmarshalJSON(content []byte) error

type ListenAddress

type ListenAddress netip.Addr

func NewListenAddress added in v1.2.0

func NewListenAddress(addr netip.Addr) *ListenAddress

func (*ListenAddress) Build added in v1.0.1

func (a *ListenAddress) Build() netip.Addr

func (ListenAddress) MarshalJSON

func (a ListenAddress) MarshalJSON() ([]byte, error)

func (*ListenAddress) UnmarshalJSON

func (a *ListenAddress) UnmarshalJSON(content []byte) error

type ListenOptions

type ListenOptions struct {
	Listen                      *ListenAddress `json:"listen,omitempty"`
	ListenPort                  uint16         `json:"listen_port,omitempty"`
	TCPFastOpen                 bool           `json:"tcp_fast_open,omitempty"`
	UDPFragment                 *bool          `json:"udp_fragment,omitempty"`
	UDPFragmentDefault          bool           `json:"-"`
	UDPTimeout                  int64          `json:"udp_timeout,omitempty"`
	ProxyProtocol               bool           `json:"proxy_protocol,omitempty"`
	ProxyProtocolAcceptNoHeader bool           `json:"proxy_protocol_accept_no_header,omitempty"`
	Detour                      string         `json:"detour,omitempty"`
	InboundOptions
}

type ListenPrefix

type ListenPrefix netip.Prefix

func (ListenPrefix) Build

func (p ListenPrefix) Build() netip.Prefix

func (ListenPrefix) MarshalJSON

func (p ListenPrefix) MarshalJSON() ([]byte, error)

func (*ListenPrefix) UnmarshalJSON

func (p *ListenPrefix) UnmarshalJSON(bytes []byte) error

type LogOptions

type LogOptions struct {
	Disabled     bool   `json:"disabled,omitempty"`
	Level        string `json:"level,omitempty"`
	Output       string `json:"output,omitempty"`
	Timestamp    bool   `json:"timestamp,omitempty"`
	DisableColor bool   `json:"-"`
}

type LogicalDNSRule

type LogicalDNSRule struct {
	Mode         string           `json:"mode"`
	Rules        []DefaultDNSRule `json:"rules,omitempty"`
	Invert       bool             `json:"invert,omitempty"`
	Server       string           `json:"server,omitempty"`
	DisableCache bool             `json:"disable_cache,omitempty"`
}

func (LogicalDNSRule) IsValid

func (r LogicalDNSRule) IsValid() bool

type LogicalRule

type LogicalRule struct {
	Mode     string        `json:"mode"`
	Rules    []DefaultRule `json:"rules,omitempty"`
	Invert   bool          `json:"invert,omitempty"`
	Outbound string        `json:"outbound,omitempty"`
}

func (LogicalRule) IsValid

func (r LogicalRule) IsValid() bool

type MultiplexOptions

type MultiplexOptions struct {
	Enabled        bool   `json:"enabled,omitempty"`
	Protocol       string `json:"protocol,omitempty"`
	MaxConnections int    `json:"max_connections,omitempty"`
	MinStreams     int    `json:"min_streams,omitempty"`
	MaxStreams     int    `json:"max_streams,omitempty"`
}

type NTPOptions added in v1.2.0

type NTPOptions struct {
	Enabled       bool     `json:"enabled"`
	Interval      Duration `json:"interval,omitempty"`
	WriteToSystem bool     `json:"write_to_system,omitempty"`
	ServerOptions
	DialerOptions
}

type NaiveInboundOptions

type NaiveInboundOptions struct {
	ListenOptions
	Users   []auth.User        `json:"users,omitempty"`
	Network NetworkList        `json:"network,omitempty"`
	TLS     *InboundTLSOptions `json:"tls,omitempty"`
}

type NetworkList

type NetworkList string

func (NetworkList) Build

func (v NetworkList) Build() []string

func (*NetworkList) UnmarshalJSON

func (v *NetworkList) UnmarshalJSON(content []byte) error

type OnDemandOptions added in v1.2.0

type OnDemandOptions struct {
	Enabled bool           `json:"enabled,omitempty"`
	Rules   []OnDemandRule `json:"rules,omitempty"`
}

type OnDemandRule added in v1.2.0

type OnDemandRule struct {
	Action                *OnDemandRuleAction        `json:"action,omitempty"`
	DNSSearchDomainMatch  Listable[string]           `json:"dns_search_domain_match,omitempty"`
	DNSServerAddressMatch Listable[string]           `json:"dns_server_address_match,omitempty"`
	InterfaceTypeMatch    *OnDemandRuleInterfaceType `json:"interface_type_match,omitempty"`
	SSIDMatch             Listable[string]           `json:"ssid_match,omitempty"`
	ProbeURL              string                     `json:"probe_url,omitempty"`
}

type OnDemandRuleAction added in v1.2.0

type OnDemandRuleAction int

func (*OnDemandRuleAction) MarshalJSON added in v1.2.0

func (r *OnDemandRuleAction) MarshalJSON() ([]byte, error)

func (*OnDemandRuleAction) UnmarshalJSON added in v1.2.0

func (r *OnDemandRuleAction) UnmarshalJSON(bytes []byte) error

type OnDemandRuleInterfaceType added in v1.2.0

type OnDemandRuleInterfaceType int

func (*OnDemandRuleInterfaceType) MarshalJSON added in v1.2.0

func (r *OnDemandRuleInterfaceType) MarshalJSON() ([]byte, error)

func (*OnDemandRuleInterfaceType) UnmarshalJSON added in v1.2.0

func (r *OnDemandRuleInterfaceType) UnmarshalJSON(bytes []byte) error

type Options

type Options _Options

func (*Options) UnmarshalJSON

func (o *Options) UnmarshalJSON(content []byte) error

type Outbound

type Outbound _Outbound

func (Outbound) MarshalJSON

func (h Outbound) MarshalJSON() ([]byte, error)

func (*Outbound) UnmarshalJSON

func (h *Outbound) UnmarshalJSON(bytes []byte) error

type OutboundECHOptions added in v1.1.0

type OutboundECHOptions struct {
	Enabled                     bool   `json:"enabled,omitempty"`
	PQSignatureSchemesEnabled   bool   `json:"pq_signature_schemes_enabled,omitempty"`
	DynamicRecordSizingDisabled bool   `json:"dynamic_record_sizing_disabled,omitempty"`
	Config                      string `json:"config,omitempty"`
}

type OutboundRealityOptions added in v1.2.0

type OutboundRealityOptions struct {
	Enabled   bool   `json:"enabled,omitempty"`
	PublicKey string `json:"public_key,omitempty"`
	ShortID   string `json:"short_id,omitempty"`
}

type OutboundTLSOptions

type OutboundTLSOptions struct {
	Enabled         bool                    `json:"enabled,omitempty"`
	DisableSNI      bool                    `json:"disable_sni,omitempty"`
	ServerName      string                  `json:"server_name,omitempty"`
	Insecure        bool                    `json:"insecure,omitempty"`
	ALPN            Listable[string]        `json:"alpn,omitempty"`
	MinVersion      string                  `json:"min_version,omitempty"`
	MaxVersion      string                  `json:"max_version,omitempty"`
	CipherSuites    Listable[string]        `json:"cipher_suites,omitempty"`
	Certificate     string                  `json:"certificate,omitempty"`
	CertificatePath string                  `json:"certificate_path,omitempty"`
	ECH             *OutboundECHOptions     `json:"ech,omitempty"`
	UTLS            *OutboundUTLSOptions    `json:"utls,omitempty"`
	Reality         *OutboundRealityOptions `json:"reality,omitempty"`
}

type OutboundUTLSOptions added in v1.1.0

type OutboundUTLSOptions struct {
	Enabled     bool   `json:"enabled,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty"`
}

type RedirectInboundOptions

type RedirectInboundOptions struct {
	ListenOptions
}

type RouteOptions

type RouteOptions struct {
	GeoIP               *GeoIPOptions   `json:"geoip,omitempty"`
	Geosite             *GeositeOptions `json:"geosite,omitempty"`
	Rules               []Rule          `json:"rules,omitempty"`
	Final               string          `json:"final,omitempty"`
	FindProcess         bool            `json:"find_process,omitempty"`
	AutoDetectInterface bool            `json:"auto_detect_interface,omitempty"`
	OverrideAndroidVPN  bool            `json:"override_android_vpn,omitempty"`
	DefaultInterface    string          `json:"default_interface,omitempty"`
	DefaultMark         int             `json:"default_mark,omitempty"`
}

type Rule

type Rule _Rule

func (Rule) MarshalJSON

func (r Rule) MarshalJSON() ([]byte, error)

func (*Rule) UnmarshalJSON

func (r *Rule) UnmarshalJSON(bytes []byte) error

type SSHOutboundOptions added in v1.0.1

type SSHOutboundOptions struct {
	DialerOptions
	ServerOptions
	User                 string           `json:"user,omitempty"`
	Password             string           `json:"password,omitempty"`
	PrivateKey           string           `json:"private_key,omitempty"`
	PrivateKeyPath       string           `json:"private_key_path,omitempty"`
	PrivateKeyPassphrase string           `json:"private_key_passphrase,omitempty"`
	HostKey              Listable[string] `json:"host_key,omitempty"`
	HostKeyAlgorithms    Listable[string] `json:"host_key_algorithms,omitempty"`
	ClientVersion        string           `json:"client_version,omitempty"`
}

type SelectorOutboundOptions

type SelectorOutboundOptions struct {
	Outbounds []string `json:"outbounds"`
	Default   string   `json:"default,omitempty"`
}

type ServerOptions

type ServerOptions struct {
	Server     string `json:"server"`
	ServerPort uint16 `json:"server_port"`
}

func (ServerOptions) Build

func (o ServerOptions) Build() M.Socksaddr

type ShadowTLSHandshakeOptions added in v1.0.1

type ShadowTLSHandshakeOptions struct {
	ServerOptions
	DialerOptions
}

type ShadowTLSInboundOptions added in v1.0.1

type ShadowTLSInboundOptions struct {
	ListenOptions
	Version                int                                  `json:"version,omitempty"`
	Password               string                               `json:"password,omitempty"`
	Users                  []ShadowTLSUser                      `json:"users,omitempty"`
	Handshake              ShadowTLSHandshakeOptions            `json:"handshake,omitempty"`
	HandshakeForServerName map[string]ShadowTLSHandshakeOptions `json:"handshake_for_server_name,omitempty"`
	StrictMode             bool                                 `json:"strict_mode,omitempty"`
}

type ShadowTLSOutboundOptions added in v1.0.1

type ShadowTLSOutboundOptions struct {
	DialerOptions
	ServerOptions
	Version  int                 `json:"version,omitempty"`
	Password string              `json:"password,omitempty"`
	TLS      *OutboundTLSOptions `json:"tls,omitempty"`
}

type ShadowTLSUser added in v1.2.0

type ShadowTLSUser struct {
	Name     string `json:"name,omitempty"`
	Password string `json:"password,omitempty"`
}

type ShadowsocksDestination

type ShadowsocksDestination struct {
	Name     string `json:"name"`
	Password string `json:"password"`
	ServerOptions
}

type ShadowsocksInboundOptions

type ShadowsocksInboundOptions struct {
	ListenOptions
	Network      NetworkList              `json:"network,omitempty"`
	Method       string                   `json:"method"`
	Password     string                   `json:"password"`
	Users        []ShadowsocksUser        `json:"users,omitempty"`
	Destinations []ShadowsocksDestination `json:"destinations,omitempty"`
}

type ShadowsocksOutboundOptions

type ShadowsocksOutboundOptions struct {
	DialerOptions
	ServerOptions
	Method            string             `json:"method"`
	Password          string             `json:"password"`
	Plugin            string             `json:"plugin,omitempty"`
	PluginOptions     string             `json:"plugin_opts,omitempty"`
	Network           NetworkList        `json:"network,omitempty"`
	UDPOverTCPOptions *UDPOverTCPOptions `json:"udp_over_tcp,omitempty"`
	MultiplexOptions  *MultiplexOptions  `json:"multiplex,omitempty"`
}

type ShadowsocksROutboundOptions added in v1.1.0

type ShadowsocksROutboundOptions struct {
	DialerOptions
	ServerOptions
	Method        string      `json:"method"`
	Password      string      `json:"password"`
	Obfs          string      `json:"obfs,omitempty"`
	ObfsParam     string      `json:"obfs_param,omitempty"`
	Protocol      string      `json:"protocol,omitempty"`
	ProtocolParam string      `json:"protocol_param,omitempty"`
	Network       NetworkList `json:"network,omitempty"`
}

type ShadowsocksUser

type ShadowsocksUser struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

type SocksInboundOptions

type SocksInboundOptions struct {
	ListenOptions
	Users []auth.User `json:"users,omitempty"`
}

type SocksOutboundOptions

type SocksOutboundOptions struct {
	DialerOptions
	ServerOptions
	Version           string             `json:"version,omitempty"`
	Username          string             `json:"username,omitempty"`
	Password          string             `json:"password,omitempty"`
	Network           NetworkList        `json:"network,omitempty"`
	UDPOverTCPOptions *UDPOverTCPOptions `json:"udp_over_tcp,omitempty"`
}

type TProxyInboundOptions

type TProxyInboundOptions struct {
	ListenOptions
	Network NetworkList `json:"network,omitempty"`
}

type TorOutboundOptions added in v1.0.1

type TorOutboundOptions struct {
	DialerOptions
	ExecutablePath string            `json:"executable_path,omitempty"`
	ExtraArgs      []string          `json:"extra_args,omitempty"`
	DataDirectory  string            `json:"data_directory,omitempty"`
	Options        map[string]string `json:"torrc,omitempty"`
}

type TrojanInboundOptions

type TrojanInboundOptions struct {
	ListenOptions
	Users           []TrojanUser              `json:"users,omitempty"`
	TLS             *InboundTLSOptions        `json:"tls,omitempty"`
	Fallback        *ServerOptions            `json:"fallback,omitempty"`
	FallbackForALPN map[string]*ServerOptions `json:"fallback_for_alpn,omitempty"`
	Transport       *V2RayTransportOptions    `json:"transport,omitempty"`
}

type TrojanOutboundOptions

type TrojanOutboundOptions struct {
	DialerOptions
	ServerOptions
	Password  string                 `json:"password"`
	Network   NetworkList            `json:"network,omitempty"`
	TLS       *OutboundTLSOptions    `json:"tls,omitempty"`
	Multiplex *MultiplexOptions      `json:"multiplex,omitempty"`
	Transport *V2RayTransportOptions `json:"transport,omitempty"`
}

type TrojanUser

type TrojanUser struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

type TunInboundOptions

type TunInboundOptions struct {
	InterfaceName          string                 `json:"interface_name,omitempty"`
	MTU                    uint32                 `json:"mtu,omitempty"`
	Inet4Address           Listable[ListenPrefix] `json:"inet4_address,omitempty"`
	Inet6Address           Listable[ListenPrefix] `json:"inet6_address,omitempty"`
	AutoRoute              bool                   `json:"auto_route,omitempty"`
	StrictRoute            bool                   `json:"strict_route,omitempty"`
	Inet4RouteAddress      Listable[ListenPrefix] `json:"inet4_route_address,omitempty"`
	Inet6RouteAddress      Listable[ListenPrefix] `json:"inet6_route_address,omitempty"`
	IncludeUID             Listable[uint32]       `json:"include_uid,omitempty"`
	IncludeUIDRange        Listable[string]       `json:"include_uid_range,omitempty"`
	ExcludeUID             Listable[uint32]       `json:"exclude_uid,omitempty"`
	ExcludeUIDRange        Listable[string]       `json:"exclude_uid_range,omitempty"`
	IncludeAndroidUser     Listable[int]          `json:"include_android_user,omitempty"`
	IncludePackage         Listable[string]       `json:"include_package,omitempty"`
	ExcludePackage         Listable[string]       `json:"exclude_package,omitempty"`
	EndpointIndependentNat bool                   `json:"endpoint_independent_nat,omitempty"`
	UDPTimeout             int64                  `json:"udp_timeout,omitempty"`
	Stack                  string                 `json:"stack,omitempty"`
	Platform               *TunPlatformOptions    `json:"platform,omitempty"`
	InboundOptions
}

type TunPlatformOptions added in v1.2.0

type TunPlatformOptions struct {
	HTTPProxy *HTTPProxyOptions `json:"http_proxy,omitempty"`
}

type UDPOverTCPOptions added in v1.2.0

type UDPOverTCPOptions _UDPOverTCPOptions

func (UDPOverTCPOptions) MarshalJSON added in v1.2.0

func (o UDPOverTCPOptions) MarshalJSON() ([]byte, error)

func (*UDPOverTCPOptions) UnmarshalJSON added in v1.2.0

func (o *UDPOverTCPOptions) UnmarshalJSON(bytes []byte) error

type URLTestOutboundOptions added in v1.1.0

type URLTestOutboundOptions struct {
	Outbounds []string `json:"outbounds"`
	URL       string   `json:"url,omitempty"`
	Interval  Duration `json:"interval,omitempty"`
	Tolerance uint16   `json:"tolerance,omitempty"`
}

type V2RayAPIOptions added in v1.1.0

type V2RayAPIOptions struct {
	Listen string                    `json:"listen,omitempty"`
	Stats  *V2RayStatsServiceOptions `json:"stats,omitempty"`
}

type V2RayGRPCOptions added in v1.0.1

type V2RayGRPCOptions struct {
	ServiceName         string   `json:"service_name,omitempty"`
	IdleTimeout         Duration `json:"idle_timeout,omitempty"`
	PingTimeout         Duration `json:"ping_timeout,omitempty"`
	PermitWithoutStream bool     `json:"permit_without_stream,omitempty"`
	ForceLite           bool     `json:"-"` // for test
}

type V2RayHTTPOptions added in v1.0.1

type V2RayHTTPOptions struct {
	Host        Listable[string]  `json:"host,omitempty"`
	Path        string            `json:"path,omitempty"`
	Method      string            `json:"method,omitempty"`
	Headers     map[string]string `json:"headers,omitempty"`
	IdleTimeout Duration          `json:"idle_timeout,omitempty"`
	PingTimeout Duration          `json:"ping_timeout,omitempty"`
}

type V2RayQUICOptions added in v1.0.1

type V2RayQUICOptions struct{}

type V2RayStatsServiceOptions added in v1.1.0

type V2RayStatsServiceOptions struct {
	Enabled   bool     `json:"enabled,omitempty"`
	Inbounds  []string `json:"inbounds,omitempty"`
	Outbounds []string `json:"outbounds,omitempty"`
	Users     []string `json:"users,omitempty"`
}

type V2RayTransportOptions added in v1.0.1

type V2RayTransportOptions _V2RayTransportOptions

func (V2RayTransportOptions) MarshalJSON added in v1.0.1

func (o V2RayTransportOptions) MarshalJSON() ([]byte, error)

func (*V2RayTransportOptions) UnmarshalJSON added in v1.0.1

func (o *V2RayTransportOptions) UnmarshalJSON(bytes []byte) error

type V2RayWebsocketOptions added in v1.0.1

type V2RayWebsocketOptions struct {
	Path                string            `json:"path,omitempty"`
	Headers             map[string]string `json:"headers,omitempty"`
	MaxEarlyData        uint32            `json:"max_early_data,omitempty"`
	EarlyDataHeaderName string            `json:"early_data_header_name,omitempty"`
}

type VLESSInboundOptions added in v1.2.0

type VLESSInboundOptions struct {
	ListenOptions
	Users     []VLESSUser            `json:"users,omitempty"`
	TLS       *InboundTLSOptions     `json:"tls,omitempty"`
	Transport *V2RayTransportOptions `json:"transport,omitempty"`
}

type VLESSOutboundOptions added in v1.1.0

type VLESSOutboundOptions struct {
	DialerOptions
	ServerOptions
	UUID           string                 `json:"uuid"`
	Flow           string                 `json:"flow,omitempty"`
	Network        NetworkList            `json:"network,omitempty"`
	TLS            *OutboundTLSOptions    `json:"tls,omitempty"`
	Transport      *V2RayTransportOptions `json:"transport,omitempty"`
	PacketEncoding *string                `json:"packet_encoding,omitempty"`
}

type VLESSUser added in v1.2.0

type VLESSUser struct {
	Name string `json:"name"`
	UUID string `json:"uuid"`
	Flow string `json:"flow,omitempty"`
}

type VMessInboundOptions

type VMessInboundOptions struct {
	ListenOptions
	Users     []VMessUser            `json:"users,omitempty"`
	TLS       *InboundTLSOptions     `json:"tls,omitempty"`
	Transport *V2RayTransportOptions `json:"transport,omitempty"`
}

type VMessOutboundOptions

type VMessOutboundOptions struct {
	DialerOptions
	ServerOptions
	UUID                string                 `json:"uuid"`
	Security            string                 `json:"security"`
	AlterId             int                    `json:"alter_id,omitempty"`
	GlobalPadding       bool                   `json:"global_padding,omitempty"`
	AuthenticatedLength bool                   `json:"authenticated_length,omitempty"`
	Network             NetworkList            `json:"network,omitempty"`
	TLS                 *OutboundTLSOptions    `json:"tls,omitempty"`
	PacketEncoding      string                 `json:"packet_encoding,omitempty"`
	Multiplex           *MultiplexOptions      `json:"multiplex,omitempty"`
	Transport           *V2RayTransportOptions `json:"transport,omitempty"`
}

type VMessUser

type VMessUser struct {
	Name    string `json:"name"`
	UUID    string `json:"uuid"`
	AlterId int    `json:"alterId,omitempty"`
}

type WireGuardOutboundOptions added in v1.0.1

type WireGuardOutboundOptions struct {
	DialerOptions
	ServerOptions
	SystemInterface bool                   `json:"system_interface,omitempty"`
	InterfaceName   string                 `json:"interface_name,omitempty"`
	LocalAddress    Listable[ListenPrefix] `json:"local_address"`
	PrivateKey      string                 `json:"private_key"`
	PeerPublicKey   string                 `json:"peer_public_key"`
	PreSharedKey    string                 `json:"pre_shared_key,omitempty"`
	Reserved        []uint8                `json:"reserved,omitempty"`
	Workers         int                    `json:"workers,omitempty"`
	MTU             uint32                 `json:"mtu,omitempty"`
	Network         NetworkList            `json:"network,omitempty"`
}

Jump to

Keyboard shortcuts

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