option

package
v1.12.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: GPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithDontUpgrade added in v1.12.4

func ContextWithDontUpgrade(ctx context.Context) context.Context

func DNSQueryTypeToString

func DNSQueryTypeToString(queryType uint16) string

func ParseIntRange

func ParseIntRange(str string) ([]int, error)

Types

type ACMEDNS01AliDNSOptions

type ACMEDNS01AliDNSOptions struct {
	AccessKeyID     string `json:"access_key_id,omitempty"`
	AccessKeySecret string `json:"access_key_secret,omitempty"`
	RegionID        string `json:"region_id,omitempty"`
}

type ACMEDNS01ChallengeOptions

type ACMEDNS01ChallengeOptions _ACMEDNS01ChallengeOptions

func (ACMEDNS01ChallengeOptions) MarshalJSON

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

func (*ACMEDNS01ChallengeOptions) UnmarshalJSON

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

type ACMEDNS01CloudflareOptions

type ACMEDNS01CloudflareOptions struct {
	APIToken string `json:"api_token,omitempty"`
}

type ACMEExternalAccountOptions

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

type AnyTLSInboundOptions added in v1.12.4

type AnyTLSInboundOptions struct {
	ListenOptions
	InboundTLSOptionsContainer
	Users         []AnyTLSUser               `json:"users,omitempty"`
	PaddingScheme badoption.Listable[string] `json:"padding_scheme,omitempty"`
}

type AnyTLSOutboundOptions added in v1.12.4

type AnyTLSOutboundOptions struct {
	DialerOptions
	ServerOptions
	OutboundTLSOptionsContainer
	Password                 string             `json:"password,omitempty"`
	IdleSessionCheckInterval badoption.Duration `json:"idle_session_check_interval,omitempty"`
	IdleSessionTimeout       badoption.Duration `json:"idle_session_timeout,omitempty"`
	MinIdleSession           int                `json:"min_idle_session,omitempty"`
}

type AnyTLSUser added in v1.12.4

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

type BrutalOptions

type BrutalOptions struct {
	Enabled  bool `json:"enabled,omitempty"`
	UpMbps   int  `json:"up_mbps,omitempty"`
	DownMbps int  `json:"down_mbps,omitempty"`
}

type CacheFileOptions

type CacheFileOptions struct {
	Enabled     bool               `json:"enabled,omitempty"`
	Path        string             `json:"path,omitempty"`
	CacheID     string             `json:"cache_id,omitempty"`
	StoreFakeIP bool               `json:"store_fakeip,omitempty"`
	StoreRDRC   bool               `json:"store_rdrc,omitempty"`
	RDRCTimeout badoption.Duration `json:"rdrc_timeout,omitempty"`
}

type CertificateOptions added in v1.12.4

type CertificateOptions _CertificateOptions

func (CertificateOptions) MarshalJSON added in v1.12.4

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

func (*CertificateOptions) UnmarshalJSON added in v1.12.4

func (o *CertificateOptions) UnmarshalJSON(data []byte) error

type ClashAPIOptions

type ClashAPIOptions struct {
	ExternalController               string                     `json:"external_controller,omitempty"`
	ExternalUI                       string                     `json:"external_ui,omitempty"`
	ExternalUIDownloadURL            string                     `json:"external_ui_download_url,omitempty"`
	ExternalUIDownloadDetour         string                     `json:"external_ui_download_detour,omitempty"`
	Secret                           string                     `json:"secret,omitempty"`
	DefaultMode                      string                     `json:"default_mode,omitempty"`
	ModeList                         []string                   `json:"-"`
	AccessControlAllowOrigin         badoption.Listable[string] `json:"access_control_allow_origin,omitempty"`
	AccessControlAllowPrivateNetwork bool                       `json:"access_control_allow_private_network,omitempty"`

	// Deprecated: migrated to global cache file
	CacheFile string `json:"cache_file,omitempty"`
	// Deprecated: migrated to global cache file
	CacheID string `json:"cache_id,omitempty"`
	// Deprecated: migrated to global cache file
	StoreMode bool `json:"store_mode,omitempty"`
	// Deprecated: migrated to global cache file
	StoreSelected bool `json:"store_selected,omitempty"`
	// Deprecated: migrated to global cache file
	StoreFakeIP bool `json:"store_fakeip,omitempty"`
}

type DERPMeshOptions added in v1.12.4

type DERPMeshOptions struct {
	ServerOptions
	Host string `json:"host,omitempty"`
	OutboundTLSOptionsContainer
	DialerOptions
}

type DERPSTUNListenOptions added in v1.12.4

type DERPSTUNListenOptions _DERPSTUNListenOptions

func (DERPSTUNListenOptions) MarshalJSON added in v1.12.4

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

func (*DERPSTUNListenOptions) UnmarshalJSON added in v1.12.4

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

type DERPServiceOptions added in v1.12.4

type DERPServiceOptions struct {
	ListenOptions
	InboundTLSOptionsContainer
	ConfigPath           string                                          `json:"config_path,omitempty"`
	VerifyClientEndpoint badoption.Listable[string]                      `json:"verify_client_endpoint,omitempty"`
	VerifyClientURL      badoption.Listable[*DERPVerifyClientURLOptions] `json:"verify_client_url,omitempty"`
	Home                 string                                          `json:"home,omitempty"`
	MeshWith             badoption.Listable[*DERPMeshOptions]            `json:"mesh_with,omitempty"`
	MeshPSK              string                                          `json:"mesh_psk,omitempty"`
	MeshPSKFile          string                                          `json:"mesh_psk_file,omitempty"`
	STUN                 *DERPSTUNListenOptions                          `json:"stun,omitempty"`
}

type DERPVerifyClientURLOptions added in v1.12.4

type DERPVerifyClientURLOptions _DERPVerifyClientURLOptions

func (DERPVerifyClientURLOptions) MarshalJSON added in v1.12.4

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

func (DERPVerifyClientURLOptions) ServerIsDomain added in v1.12.4

func (d DERPVerifyClientURLOptions) ServerIsDomain() bool

func (*DERPVerifyClientURLOptions) UnmarshalJSON added in v1.12.4

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

type DHCPDNSServerOptions added in v1.12.4

type DHCPDNSServerOptions struct {
	LocalDNSServerOptions
	Interface string `json:"interface,omitempty"`
}

type DNSClientOptions

type DNSClientOptions struct {
	Strategy         DomainStrategy        `json:"strategy,omitempty"`
	DisableCache     bool                  `json:"disable_cache,omitempty"`
	DisableExpire    bool                  `json:"disable_expire,omitempty"`
	IndependentCache bool                  `json:"independent_cache,omitempty"`
	CacheCapacity    uint32                `json:"cache_capacity,omitempty"`
	ClientSubnet     *badoption.Prefixable `json:"client_subnet,omitempty"`
}

type DNSOptions

type DNSOptions struct {
	RawDNSOptions
	LegacyDNSOptions
}

func (*DNSOptions) UnmarshalJSONContext added in v1.12.4

func (o *DNSOptions) UnmarshalJSONContext(ctx context.Context, content []byte) error

type DNSQueryType

type DNSQueryType uint16

func (DNSQueryType) MarshalJSON

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

func (DNSQueryType) String

func (t DNSQueryType) String() string

func (*DNSQueryType) UnmarshalJSON

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

type DNSRCode added in v1.12.4

type DNSRCode int

func (*DNSRCode) Build added in v1.12.4

func (r *DNSRCode) Build() int

func (DNSRCode) MarshalJSON added in v1.12.4

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

func (*DNSRCode) UnmarshalJSON added in v1.12.4

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

type DNSRecordOptions added in v1.12.4

type DNSRecordOptions struct {
	dns.RR
	// contains filtered or unexported fields
}

func (DNSRecordOptions) Build added in v1.12.4

func (o DNSRecordOptions) Build() dns.RR

func (DNSRecordOptions) MarshalJSON added in v1.12.4

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

func (*DNSRecordOptions) UnmarshalJSON added in v1.12.4

func (o *DNSRecordOptions) UnmarshalJSON(data []byte) error

type DNSRouteActionOptions added in v1.12.4

type DNSRouteActionOptions struct {
	Server       string                `json:"server,omitempty"`
	Strategy     DomainStrategy        `json:"strategy,omitempty"`
	DisableCache bool                  `json:"disable_cache,omitempty"`
	RewriteTTL   *uint32               `json:"rewrite_ttl,omitempty"`
	ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
}

type DNSRouteActionPredefined added in v1.12.4

type DNSRouteActionPredefined struct {
	Rcode  *DNSRCode                            `json:"rcode,omitempty"`
	Answer badoption.Listable[DNSRecordOptions] `json:"answer,omitempty"`
	Ns     badoption.Listable[DNSRecordOptions] `json:"ns,omitempty"`
	Extra  badoption.Listable[DNSRecordOptions] `json:"extra,omitempty"`
}

type DNSRouteOptionsActionOptions added in v1.12.4

type DNSRouteOptionsActionOptions _DNSRouteOptionsActionOptions

func (*DNSRouteOptionsActionOptions) UnmarshalJSON added in v1.12.4

func (r *DNSRouteOptionsActionOptions) UnmarshalJSON(data []byte) error

type DNSRule

type DNSRule _DNSRule

func (DNSRule) IsValid

func (r DNSRule) IsValid() bool

func (DNSRule) MarshalJSON

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

func (*DNSRule) UnmarshalJSONContext added in v1.12.4

func (r *DNSRule) UnmarshalJSONContext(ctx context.Context, bytes []byte) error

type DNSRuleAction added in v1.12.4

type DNSRuleAction _DNSRuleAction

func (DNSRuleAction) MarshalJSON added in v1.12.4

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

func (*DNSRuleAction) UnmarshalJSONContext added in v1.12.4

func (r *DNSRuleAction) UnmarshalJSONContext(ctx context.Context, data []byte) error

type DNSServerAddressOptions added in v1.12.4

type DNSServerAddressOptions struct {
	Server     string `json:"server"`
	ServerPort uint16 `json:"server_port,omitempty"`
}

func (DNSServerAddressOptions) Build added in v1.12.4

func (*DNSServerAddressOptions) ReplaceServerOptions added in v1.12.4

func (o *DNSServerAddressOptions) ReplaceServerOptions(options ServerOptions)

func (DNSServerAddressOptions) ServerIsDomain added in v1.12.4

func (o DNSServerAddressOptions) ServerIsDomain() bool

func (*DNSServerAddressOptions) TakeServerOptions added in v1.12.4

func (o *DNSServerAddressOptions) TakeServerOptions() ServerOptions

type DNSServerOptions

type DNSServerOptions _DNSServerOptions

func (*DNSServerOptions) MarshalJSONContext added in v1.12.4

func (o *DNSServerOptions) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*DNSServerOptions) UnmarshalJSONContext added in v1.12.4

func (o *DNSServerOptions) UnmarshalJSONContext(ctx context.Context, content []byte) error

func (*DNSServerOptions) Upgrade added in v1.12.4

func (o *DNSServerOptions) Upgrade(ctx context.Context) error

type DNSTransportOptionsRegistry added in v1.12.4

type DNSTransportOptionsRegistry interface {
	CreateOptions(transportType string) (any, bool)
}

type DebugOptions

type DebugOptions struct {
	Listen       string                   `json:"listen,omitempty"`
	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  *byteformats.MemoryBytes `json:"memory_limit,omitempty"`
	OOMKiller    *bool                    `json:"oom_killer,omitempty"`
}

type DefaultDNSRule

type DefaultDNSRule struct {
	RawDefaultDNSRule
	DNSRuleAction
}

func (DefaultDNSRule) IsValid

func (r DefaultDNSRule) IsValid() bool

func (DefaultDNSRule) MarshalJSON added in v1.12.4

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

func (*DefaultDNSRule) UnmarshalJSONContext added in v1.12.4

func (r *DefaultDNSRule) UnmarshalJSONContext(ctx context.Context, data []byte) error

type DefaultHeadlessRule

type DefaultHeadlessRule struct {
	QueryType            badoption.Listable[DNSQueryType]  `json:"query_type,omitempty"`
	Network              badoption.Listable[string]        `json:"network,omitempty"`
	Domain               badoption.Listable[string]        `json:"domain,omitempty"`
	DomainSuffix         badoption.Listable[string]        `json:"domain_suffix,omitempty"`
	DomainKeyword        badoption.Listable[string]        `json:"domain_keyword,omitempty"`
	DomainRegex          badoption.Listable[string]        `json:"domain_regex,omitempty"`
	SourceIPCIDR         badoption.Listable[string]        `json:"source_ip_cidr,omitempty"`
	IPCIDR               badoption.Listable[string]        `json:"ip_cidr,omitempty"`
	SourcePort           badoption.Listable[uint16]        `json:"source_port,omitempty"`
	SourcePortRange      badoption.Listable[string]        `json:"source_port_range,omitempty"`
	Port                 badoption.Listable[uint16]        `json:"port,omitempty"`
	PortRange            badoption.Listable[string]        `json:"port_range,omitempty"`
	ProcessName          badoption.Listable[string]        `json:"process_name,omitempty"`
	ProcessPath          badoption.Listable[string]        `json:"process_path,omitempty"`
	ProcessPathRegex     badoption.Listable[string]        `json:"process_path_regex,omitempty"`
	PackageName          badoption.Listable[string]        `json:"package_name,omitempty"`
	NetworkType          badoption.Listable[InterfaceType] `json:"network_type,omitempty"`
	NetworkIsExpensive   bool                              `json:"network_is_expensive,omitempty"`
	NetworkIsConstrained bool                              `json:"network_is_constrained,omitempty"`
	WIFISSID             badoption.Listable[string]        `json:"wifi_ssid,omitempty"`
	WIFIBSSID            badoption.Listable[string]        `json:"wifi_bssid,omitempty"`
	Invert               bool                              `json:"invert,omitempty"`

	DomainMatcher *domain.Matcher `json:"-"`
	SourceIPSet   *netipx.IPSet   `json:"-"`
	IPSet         *netipx.IPSet   `json:"-"`

	AdGuardDomain        badoption.Listable[string] `json:"-"`
	AdGuardDomainMatcher *domain.AdGuardMatcher     `json:"-"`
}

func (DefaultHeadlessRule) IsValid

func (r DefaultHeadlessRule) IsValid() bool

type DefaultRule

type DefaultRule struct {
	RawDefaultRule
	RuleAction
}

func (DefaultRule) IsValid

func (r DefaultRule) IsValid() bool

func (DefaultRule) MarshalJSON added in v1.12.4

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

func (*DefaultRule) UnmarshalJSON added in v1.12.4

func (r *DefaultRule) UnmarshalJSON(data []byte) error

type DialerOptions

type DialerOptions struct {
	Detour              string                            `json:"detour,omitempty"`
	BindInterface       string                            `json:"bind_interface,omitempty"`
	Inet4BindAddress    *badoption.Addr                   `json:"inet4_bind_address,omitempty"`
	Inet6BindAddress    *badoption.Addr                   `json:"inet6_bind_address,omitempty"`
	ProtectPath         string                            `json:"protect_path,omitempty"`
	RoutingMark         FwMark                            `json:"routing_mark,omitempty"`
	ReuseAddr           bool                              `json:"reuse_addr,omitempty"`
	NetNs               string                            `json:"netns,omitempty"`
	ConnectTimeout      badoption.Duration                `json:"connect_timeout,omitempty"`
	TCPFastOpen         bool                              `json:"tcp_fast_open,omitempty"`
	TCPMultiPath        bool                              `json:"tcp_multi_path,omitempty"`
	UDPFragment         *bool                             `json:"udp_fragment,omitempty"`
	UDPFragmentDefault  bool                              `json:"-"`
	DomainResolver      *DomainResolveOptions             `json:"domain_resolver,omitempty"`
	NetworkStrategy     *NetworkStrategy                  `json:"network_strategy,omitempty"`
	NetworkType         badoption.Listable[InterfaceType] `json:"network_type,omitempty"`
	FallbackNetworkType badoption.Listable[InterfaceType] `json:"fallback_network_type,omitempty"`
	FallbackDelay       badoption.Duration                `json:"fallback_delay,omitempty"`

	// Deprecated: migrated to domain resolver
	DomainStrategy DomainStrategy `json:"domain_strategy,omitempty"`
}

func (*DialerOptions) ReplaceDialerOptions

func (o *DialerOptions) ReplaceDialerOptions(options DialerOptions)

func (*DialerOptions) TakeDialerOptions

func (o *DialerOptions) TakeDialerOptions() DialerOptions

type DialerOptionsWrapper

type DialerOptionsWrapper interface {
	TakeDialerOptions() DialerOptions
	ReplaceDialerOptions(options DialerOptions)
}

type DirectActionOptions added in v1.12.4

type DirectActionOptions _DirectActionOptions

func (DirectActionOptions) Descriptions added in v1.12.4

func (d DirectActionOptions) Descriptions() []string

func (*DirectActionOptions) UnmarshalJSON added in v1.12.4

func (d *DirectActionOptions) UnmarshalJSON(data []byte) error

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 _DirectOutboundOptions

func (*DirectOutboundOptions) UnmarshalJSONContext added in v1.12.4

func (d *DirectOutboundOptions) UnmarshalJSONContext(ctx context.Context, content []byte) error

type DomainResolveOptions added in v1.12.4

type DomainResolveOptions _DomainResolveOptions

func (DomainResolveOptions) MarshalJSON added in v1.12.4

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

func (*DomainResolveOptions) UnmarshalJSON added in v1.12.4

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

type DomainStrategy

type DomainStrategy C.DomainStrategy

func (DomainStrategy) MarshalJSON

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

func (DomainStrategy) String added in v1.12.4

func (s DomainStrategy) String() string

func (*DomainStrategy) UnmarshalJSON

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

type Endpoint added in v1.12.4

type Endpoint _Endpoint

func (*Endpoint) MarshalJSONContext added in v1.12.4

func (h *Endpoint) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*Endpoint) UnmarshalJSONContext added in v1.12.4

func (h *Endpoint) UnmarshalJSONContext(ctx context.Context, content []byte) error

type EndpointOptionsRegistry added in v1.12.4

type EndpointOptionsRegistry interface {
	CreateOptions(endpointType string) (any, bool)
}

type ExperimentalOptions

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

type FakeIPDNSServerOptions added in v1.12.4

type FakeIPDNSServerOptions struct {
	Inet4Range *badoption.Prefix `json:"inet4_range,omitempty"`
	Inet6Range *badoption.Prefix `json:"inet6_range,omitempty"`
}

type FwMark

type FwMark uint32

func (FwMark) MarshalJSON

func (f FwMark) MarshalJSON() ([]byte, error)

func (*FwMark) UnmarshalJSON

func (f *FwMark) UnmarshalJSON(bytes []byte) error

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"`
	DomainResolver *DomainResolveOptions `json:"domain_resolver,omitempty"`
	SetSystemProxy bool                  `json:"set_system_proxy,omitempty"`
	InboundTLSOptionsContainer
}

type HTTPOutboundOptions

type HTTPOutboundOptions struct {
	DialerOptions
	ServerOptions
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	OutboundTLSOptionsContainer
	Path    string               `json:"path,omitempty"`
	Headers badoption.HTTPHeader `json:"headers,omitempty"`
}

type HTTPProxyOptions

type HTTPProxyOptions struct {
	Enabled bool `json:"enabled,omitempty"`
	ServerOptions
	BypassDomain badoption.Listable[string] `json:"bypass_domain,omitempty"`
	MatchDomain  badoption.Listable[string] `json:"match_domain,omitempty"`
}

type HeadlessRule

type HeadlessRule _HeadlessRule

func (HeadlessRule) IsValid

func (r HeadlessRule) IsValid() bool

func (HeadlessRule) MarshalJSON

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

func (*HeadlessRule) UnmarshalJSON

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

type HostsDNSServerOptions added in v1.12.4

type HostsDNSServerOptions struct {
	Path       badoption.Listable[string]                                `json:"path,omitempty"`
	Predefined *badjson.TypedMap[string, badoption.Listable[netip.Addr]] `json:"predefined,omitempty"`
}

type Hysteria2InboundOptions

type Hysteria2InboundOptions struct {
	ListenOptions
	UpMbps                int             `json:"up_mbps,omitempty"`
	DownMbps              int             `json:"down_mbps,omitempty"`
	Obfs                  *Hysteria2Obfs  `json:"obfs,omitempty"`
	Users                 []Hysteria2User `json:"users,omitempty"`
	IgnoreClientBandwidth bool            `json:"ignore_client_bandwidth,omitempty"`
	InboundTLSOptionsContainer
	Masquerade  *Hysteria2Masquerade `json:"masquerade,omitempty"`
	BrutalDebug bool                 `json:"brutal_debug,omitempty"`
}

type Hysteria2Masquerade added in v1.12.4

type Hysteria2Masquerade _Hysteria2Masquerade

func (Hysteria2Masquerade) MarshalJSON added in v1.12.4

func (m Hysteria2Masquerade) MarshalJSON() ([]byte, error)

func (*Hysteria2Masquerade) UnmarshalJSON added in v1.12.4

func (m *Hysteria2Masquerade) UnmarshalJSON(bytes []byte) error

type Hysteria2MasqueradeFile added in v1.12.4

type Hysteria2MasqueradeFile struct {
	Directory string `json:"directory"`
}

type Hysteria2MasqueradeProxy added in v1.12.4

type Hysteria2MasqueradeProxy struct {
	URL         string `json:"url"`
	RewriteHost bool   `json:"rewrite_host,omitempty"`
}

type Hysteria2MasqueradeString added in v1.12.4

type Hysteria2MasqueradeString struct {
	StatusCode int                  `json:"status_code,omitempty"`
	Headers    badoption.HTTPHeader `json:"headers,omitempty"`
	Content    string               `json:"content"`
}

type Hysteria2Obfs

type Hysteria2Obfs struct {
	Type     string `json:"type,omitempty"`
	Password string `json:"password,omitempty"`
}

type Hysteria2OutboundOptions

type Hysteria2OutboundOptions struct {
	DialerOptions
	ServerOptions
	ServerPorts badoption.Listable[string] `json:"server_ports,omitempty"`
	HopInterval badoption.Duration         `json:"hop_interval,omitempty"`
	UpMbps      int                        `json:"up_mbps,omitempty"`
	DownMbps    int                        `json:"down_mbps,omitempty"`
	Obfs        *Hysteria2Obfs             `json:"obfs,omitempty"`
	Password    string                     `json:"password,omitempty"`
	Network     NetworkList                `json:"network,omitempty"`
	OutboundTLSOptionsContainer
	BrutalDebug bool `json:"brutal_debug,omitempty"`
}

type Hysteria2User

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

type HysteriaInboundOptions

type HysteriaInboundOptions struct {
	ListenOptions
	Up                  *byteformats.NetworkBytesCompat `json:"up,omitempty"`
	UpMbps              int                             `json:"up_mbps,omitempty"`
	Down                *byteformats.NetworkBytesCompat `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"`
	InboundTLSOptionsContainer
}

type HysteriaOutboundOptions

type HysteriaOutboundOptions struct {
	DialerOptions
	ServerOptions
	ServerPorts         badoption.Listable[string]      `json:"server_ports,omitempty"`
	HopInterval         badoption.Duration              `json:"hop_interval,omitempty"`
	Up                  *byteformats.NetworkBytesCompat `json:"up,omitempty"`
	UpMbps              int                             `json:"up_mbps,omitempty"`
	Down                *byteformats.NetworkBytesCompat `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"`
	OutboundTLSOptionsContainer
}

type HysteriaUser

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) MarshalJSONContext added in v1.12.4

func (h *Inbound) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*Inbound) UnmarshalJSONContext added in v1.12.4

func (h *Inbound) UnmarshalJSONContext(ctx context.Context, content []byte) error

type InboundACMEOptions

type InboundACMEOptions struct {
	Domain                  badoption.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"`
	DNS01Challenge          *ACMEDNS01ChallengeOptions  `json:"dns01_challenge,omitempty"`
}

type InboundECHOptions

type InboundECHOptions struct {
	Enabled bool                       `json:"enabled,omitempty"`
	Key     badoption.Listable[string] `json:"key,omitempty"`
	KeyPath string                     `json:"key_path,omitempty"`

	// Deprecated: not supported by stdlib
	PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
	// Deprecated: added by fault
	DynamicRecordSizingDisabled bool `json:"dynamic_record_sizing_disabled,omitempty"`
}

type InboundMultiplexOptions

type InboundMultiplexOptions struct {
	Enabled bool           `json:"enabled,omitempty"`
	Padding bool           `json:"padding,omitempty"`
	Brutal  *BrutalOptions `json:"brutal,omitempty"`
}

type InboundOptions deprecated

type InboundOptions struct {
	SniffEnabled              bool               `json:"sniff,omitempty"`
	SniffOverrideDestination  bool               `json:"sniff_override_destination,omitempty"`
	SniffTimeout              badoption.Duration `json:"sniff_timeout,omitempty"`
	DomainStrategy            DomainStrategy     `json:"domain_strategy,omitempty"`
	UDPDisableDomainUnmapping bool               `json:"udp_disable_domain_unmapping,omitempty"`
	Detour                    string             `json:"detour,omitempty"`
}

Deprecated: Use rule action instead

type InboundOptionsRegistry added in v1.12.4

type InboundOptionsRegistry interface {
	CreateOptions(outboundType string) (any, bool)
}

type InboundRealityHandshakeOptions

type InboundRealityHandshakeOptions struct {
	ServerOptions
	DialerOptions
}

type InboundRealityOptions

type InboundRealityOptions struct {
	Enabled           bool                           `json:"enabled,omitempty"`
	Handshake         InboundRealityHandshakeOptions `json:"handshake,omitempty"`
	PrivateKey        string                         `json:"private_key,omitempty"`
	ShortID           badoption.Listable[string]     `json:"short_id,omitempty"`
	MaxTimeDifference badoption.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            badoption.Listable[string] `json:"alpn,omitempty"`
	MinVersion      string                     `json:"min_version,omitempty"`
	MaxVersion      string                     `json:"max_version,omitempty"`
	CipherSuites    badoption.Listable[string] `json:"cipher_suites,omitempty"`
	Certificate     badoption.Listable[string] `json:"certificate,omitempty"`
	CertificatePath string                     `json:"certificate_path,omitempty"`
	Key             badoption.Listable[string] `json:"key,omitempty"`
	KeyPath         string                     `json:"key_path,omitempty"`
	ACME            *InboundACMEOptions        `json:"acme,omitempty"`
	ECH             *InboundECHOptions         `json:"ech,omitempty"`
	Reality         *InboundRealityOptions     `json:"reality,omitempty"`
}

type InboundTLSOptionsContainer

type InboundTLSOptionsContainer struct {
	TLS *InboundTLSOptions `json:"tls,omitempty"`
}

func (*InboundTLSOptionsContainer) ReplaceInboundTLSOptions

func (o *InboundTLSOptionsContainer) ReplaceInboundTLSOptions(options *InboundTLSOptions)

func (*InboundTLSOptionsContainer) TakeInboundTLSOptions

func (o *InboundTLSOptionsContainer) TakeInboundTLSOptions() *InboundTLSOptions

type InboundTLSOptionsWrapper

type InboundTLSOptionsWrapper interface {
	TakeInboundTLSOptions() *InboundTLSOptions
	ReplaceInboundTLSOptions(options *InboundTLSOptions)
}

type IntRange

type IntRange struct {
	Min uint64
	Max uint64
}

func Parse2IntRange

func Parse2IntRange(str string) (IntRange, error)

func (IntRange) UniformRand

func (r IntRange) UniformRand() int64

UniformRand generate a uniform random number given the range

type InterfaceType added in v1.12.4

type InterfaceType C.InterfaceType

func (InterfaceType) Build added in v1.12.4

func (t InterfaceType) Build() C.InterfaceType

func (InterfaceType) MarshalJSON added in v1.12.4

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

func (*InterfaceType) UnmarshalJSON added in v1.12.4

func (t *InterfaceType) UnmarshalJSON(content []byte) error

type LegacyDNSFakeIPOptions added in v1.12.4

type LegacyDNSFakeIPOptions struct {
	Enabled    bool              `json:"enabled,omitempty"`
	Inet4Range *badoption.Prefix `json:"inet4_range,omitempty"`
	Inet6Range *badoption.Prefix `json:"inet6_range,omitempty"`
}

type LegacyDNSOptions added in v1.12.4

type LegacyDNSOptions struct {
	FakeIP *LegacyDNSFakeIPOptions `json:"fakeip,omitempty"`
}

type LegacyDNSServerOptions added in v1.12.4

type LegacyDNSServerOptions struct {
	Address              string                `json:"address"`
	AddressResolver      string                `json:"address_resolver,omitempty"`
	AddressStrategy      DomainStrategy        `json:"address_strategy,omitempty"`
	AddressFallbackDelay badoption.Duration    `json:"address_fallback_delay,omitempty"`
	Strategy             DomainStrategy        `json:"strategy,omitempty"`
	Detour               string                `json:"detour,omitempty"`
	ClientSubnet         *badoption.Prefixable `json:"client_subnet,omitempty"`
}

type LegacyWireGuardOutboundOptions added in v1.12.4

type LegacyWireGuardOutboundOptions struct {
	DialerOptions
	SystemInterface bool                             `json:"system_interface,omitempty"`
	GSO             bool                             `json:"gso,omitempty"`
	InterfaceName   string                           `json:"interface_name,omitempty"`
	LocalAddress    badoption.Listable[netip.Prefix] `json:"local_address"`
	PrivateKey      string                           `json:"private_key"`
	Peers           []LegacyWireGuardPeer            `json:"peers,omitempty"`
	ServerOptions
	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"`
}

type LegacyWireGuardPeer added in v1.12.4

type LegacyWireGuardPeer struct {
	ServerOptions
	PublicKey    string                           `json:"public_key,omitempty"`
	PreSharedKey string                           `json:"pre_shared_key,omitempty"`
	AllowedIPs   badoption.Listable[netip.Prefix] `json:"allowed_ips,omitempty"`
	Reserved     []uint8                          `json:"reserved,omitempty"`
}

type ListenOptions

type ListenOptions struct {
	Listen               *badoption.Addr    `json:"listen,omitempty"`
	ListenPort           uint16             `json:"listen_port,omitempty"`
	BindInterface        string             `json:"bind_interface,omitempty"`
	RoutingMark          FwMark             `json:"routing_mark,omitempty"`
	ReuseAddr            bool               `json:"reuse_addr,omitempty"`
	NetNs                string             `json:"netns,omitempty"`
	TCPKeepAlive         badoption.Duration `json:"tcp_keep_alive,omitempty"`
	TCPKeepAliveInterval badoption.Duration `json:"tcp_keep_alive_interval,omitempty"`
	TCPFastOpen          bool               `json:"tcp_fast_open,omitempty"`
	TCPMultiPath         bool               `json:"tcp_multi_path,omitempty"`
	UDPFragment          *bool              `json:"udp_fragment,omitempty"`
	UDPFragmentDefault   bool               `json:"-"`
	UDPTimeout           UDPTimeoutCompat   `json:"udp_timeout,omitempty"`

	// Deprecated: removed
	ProxyProtocol bool `json:"proxy_protocol,omitempty"`
	// Deprecated: removed
	ProxyProtocolAcceptNoHeader bool `json:"proxy_protocol_accept_no_header,omitempty"`
	InboundOptions
}

func (*ListenOptions) ReplaceListenOptions

func (o *ListenOptions) ReplaceListenOptions(options ListenOptions)

func (*ListenOptions) TakeListenOptions

func (o *ListenOptions) TakeListenOptions() ListenOptions

type ListenOptionsWrapper

type ListenOptionsWrapper interface {
	TakeListenOptions() ListenOptions
	ReplaceListenOptions(options ListenOptions)
}

type LocalDNSServerOptions added in v1.12.4

type LocalDNSServerOptions struct {
	DialerOptions
	Legacy              bool           `json:"-"`
	LegacyStrategy      DomainStrategy `json:"-"`
	LegacyDefaultDialer bool           `json:"-"`
	LegacyClientSubnet  netip.Prefix   `json:"-"`
}

type LocalRuleSet

type LocalRuleSet struct {
	Path string `json:"path,omitempty"`
}

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 {
	RawLogicalDNSRule
	DNSRuleAction
}

func (*LogicalDNSRule) IsValid

func (r *LogicalDNSRule) IsValid() bool

func (LogicalDNSRule) MarshalJSON added in v1.12.4

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

func (*LogicalDNSRule) UnmarshalJSONContext added in v1.12.4

func (r *LogicalDNSRule) UnmarshalJSONContext(ctx context.Context, data []byte) error

type LogicalHeadlessRule

type LogicalHeadlessRule struct {
	Mode   string         `json:"mode"`
	Rules  []HeadlessRule `json:"rules,omitempty"`
	Invert bool           `json:"invert,omitempty"`
}

func (LogicalHeadlessRule) IsValid

func (r LogicalHeadlessRule) IsValid() bool

type LogicalRule

type LogicalRule struct {
	RawLogicalRule
	RuleAction
}

func (*LogicalRule) IsValid

func (r *LogicalRule) IsValid() bool

func (LogicalRule) MarshalJSON added in v1.12.4

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

func (*LogicalRule) UnmarshalJSON added in v1.12.4

func (r *LogicalRule) UnmarshalJSON(data []byte) error

type NTPOptions

type NTPOptions struct {
	Enabled       bool               `json:"enabled,omitempty"`
	Interval      badoption.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"`
	InboundTLSOptionsContainer
}

type NetworkList

type NetworkList string

func (NetworkList) Build

func (v NetworkList) Build() []string

func (*NetworkList) UnmarshalJSON

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

type NetworkStrategy added in v1.12.4

type NetworkStrategy C.NetworkStrategy

func (NetworkStrategy) MarshalJSON added in v1.12.4

func (n NetworkStrategy) MarshalJSON() ([]byte, error)

func (*NetworkStrategy) UnmarshalJSON added in v1.12.4

func (n *NetworkStrategy) UnmarshalJSON(content []byte) error

type OnDemandOptions

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

type OnDemandRule

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

type OnDemandRuleAction

type OnDemandRuleAction int

func (*OnDemandRuleAction) MarshalJSON

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

func (*OnDemandRuleAction) UnmarshalJSON

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

type OnDemandRuleInterfaceType

type OnDemandRuleInterfaceType int

func (*OnDemandRuleInterfaceType) MarshalJSON

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

func (*OnDemandRuleInterfaceType) UnmarshalJSON

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

type Options

type Options _Options

func (*Options) UnmarshalJSONContext added in v1.12.4

func (o *Options) UnmarshalJSONContext(ctx context.Context, content []byte) error

type Outbound

type Outbound _Outbound

func (*Outbound) MarshalJSONContext added in v1.12.4

func (h *Outbound) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*Outbound) UnmarshalJSONContext added in v1.12.4

func (h *Outbound) UnmarshalJSONContext(ctx context.Context, content []byte) error

type OutboundECHOptions

type OutboundECHOptions struct {
	Enabled    bool                       `json:"enabled,omitempty"`
	Config     badoption.Listable[string] `json:"config,omitempty"`
	ConfigPath string                     `json:"config_path,omitempty"`

	// Deprecated: not supported by stdlib
	PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
	// Deprecated: added by fault
	DynamicRecordSizingDisabled bool `json:"dynamic_record_sizing_disabled,omitempty"`
}

type OutboundMultiplexOptions

type OutboundMultiplexOptions 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"`
	Padding        bool           `json:"padding,omitempty"`
	Brutal         *BrutalOptions `json:"brutal,omitempty"`
}

type OutboundOptionsRegistry added in v1.12.4

type OutboundOptionsRegistry interface {
	CreateOptions(outboundType string) (any, bool)
}

type OutboundRealityOptions

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                  badoption.Listable[string] `json:"alpn,omitempty"`
	MinVersion            string                     `json:"min_version,omitempty"`
	MaxVersion            string                     `json:"max_version,omitempty"`
	CipherSuites          badoption.Listable[string] `json:"cipher_suites,omitempty"`
	Certificate           badoption.Listable[string] `json:"certificate,omitempty"`
	CertificatePath       string                     `json:"certificate_path,omitempty"`
	Fragment              bool                       `json:"fragment,omitempty"`
	FragmentFallbackDelay badoption.Duration         `json:"fragment_fallback_delay,omitempty"`
	RecordFragment        bool                       `json:"record_fragment,omitempty"`
	ECH                   *OutboundECHOptions        `json:"ech,omitempty"`
	UTLS                  *OutboundUTLSOptions       `json:"utls,omitempty"`
	Reality               *OutboundRealityOptions    `json:"reality,omitempty"`
}

type OutboundTLSOptionsContainer

type OutboundTLSOptionsContainer struct {
	TLS *OutboundTLSOptions `json:"tls,omitempty"`
}

func (*OutboundTLSOptionsContainer) ReplaceOutboundTLSOptions

func (o *OutboundTLSOptionsContainer) ReplaceOutboundTLSOptions(options *OutboundTLSOptions)

func (*OutboundTLSOptionsContainer) TakeOutboundTLSOptions

func (o *OutboundTLSOptionsContainer) TakeOutboundTLSOptions() *OutboundTLSOptions

type OutboundTLSOptionsWrapper

type OutboundTLSOptionsWrapper interface {
	TakeOutboundTLSOptions() *OutboundTLSOptions
	ReplaceOutboundTLSOptions(options *OutboundTLSOptions)
}

type OutboundUTLSOptions

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

type PlainRuleSet

type PlainRuleSet struct {
	Rules []HeadlessRule `json:"rules,omitempty"`
}

type PlainRuleSetCompat

type PlainRuleSetCompat _PlainRuleSetCompat

func (PlainRuleSetCompat) MarshalJSON

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

func (*PlainRuleSetCompat) UnmarshalJSON

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

func (PlainRuleSetCompat) Upgrade

func (r PlainRuleSetCompat) Upgrade() (PlainRuleSet, error)

type RawDNSOptions added in v1.12.4

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

type RawDefaultDNSRule added in v1.12.4

type RawDefaultDNSRule struct {
	Inbound                  badoption.Listable[string]        `json:"inbound,omitempty"`
	IPVersion                int                               `json:"ip_version,omitempty"`
	QueryType                badoption.Listable[DNSQueryType]  `json:"query_type,omitempty"`
	Network                  badoption.Listable[string]        `json:"network,omitempty"`
	AuthUser                 badoption.Listable[string]        `json:"auth_user,omitempty"`
	Protocol                 badoption.Listable[string]        `json:"protocol,omitempty"`
	Domain                   badoption.Listable[string]        `json:"domain,omitempty"`
	DomainSuffix             badoption.Listable[string]        `json:"domain_suffix,omitempty"`
	DomainKeyword            badoption.Listable[string]        `json:"domain_keyword,omitempty"`
	DomainRegex              badoption.Listable[string]        `json:"domain_regex,omitempty"`
	Geosite                  badoption.Listable[string]        `json:"geosite,omitempty"`
	SourceGeoIP              badoption.Listable[string]        `json:"source_geoip,omitempty"`
	GeoIP                    badoption.Listable[string]        `json:"geoip,omitempty"`
	IPCIDR                   badoption.Listable[string]        `json:"ip_cidr,omitempty"`
	IPIsPrivate              bool                              `json:"ip_is_private,omitempty"`
	IPAcceptAny              bool                              `json:"ip_accept_any,omitempty"`
	SourceIPCIDR             badoption.Listable[string]        `json:"source_ip_cidr,omitempty"`
	SourceIPIsPrivate        bool                              `json:"source_ip_is_private,omitempty"`
	SourcePort               badoption.Listable[uint16]        `json:"source_port,omitempty"`
	SourcePortRange          badoption.Listable[string]        `json:"source_port_range,omitempty"`
	Port                     badoption.Listable[uint16]        `json:"port,omitempty"`
	PortRange                badoption.Listable[string]        `json:"port_range,omitempty"`
	ProcessName              badoption.Listable[string]        `json:"process_name,omitempty"`
	ProcessPath              badoption.Listable[string]        `json:"process_path,omitempty"`
	ProcessPathRegex         badoption.Listable[string]        `json:"process_path_regex,omitempty"`
	PackageName              badoption.Listable[string]        `json:"package_name,omitempty"`
	User                     badoption.Listable[string]        `json:"user,omitempty"`
	UserID                   badoption.Listable[int32]         `json:"user_id,omitempty"`
	Outbound                 badoption.Listable[string]        `json:"outbound,omitempty"`
	ClashMode                string                            `json:"clash_mode,omitempty"`
	NetworkType              badoption.Listable[InterfaceType] `json:"network_type,omitempty"`
	NetworkIsExpensive       bool                              `json:"network_is_expensive,omitempty"`
	NetworkIsConstrained     bool                              `json:"network_is_constrained,omitempty"`
	WIFISSID                 badoption.Listable[string]        `json:"wifi_ssid,omitempty"`
	WIFIBSSID                badoption.Listable[string]        `json:"wifi_bssid,omitempty"`
	RuleSet                  badoption.Listable[string]        `json:"rule_set,omitempty"`
	RuleSetIPCIDRMatchSource bool                              `json:"rule_set_ip_cidr_match_source,omitempty"`
	RuleSetIPCIDRAcceptEmpty bool                              `json:"rule_set_ip_cidr_accept_empty,omitempty"`
	Invert                   bool                              `json:"invert,omitempty"`

	// Deprecated: renamed to rule_set_ip_cidr_match_source
	Deprecated_RulesetIPCIDRMatchSource bool `json:"rule_set_ipcidr_match_source,omitempty"`
}

type RawDefaultRule added in v1.12.4

type RawDefaultRule struct {
	Inbound                  badoption.Listable[string]        `json:"inbound,omitempty"`
	IPVersion                int                               `json:"ip_version,omitempty"`
	Network                  badoption.Listable[string]        `json:"network,omitempty"`
	AuthUser                 badoption.Listable[string]        `json:"auth_user,omitempty"`
	Protocol                 badoption.Listable[string]        `json:"protocol,omitempty"`
	Client                   badoption.Listable[string]        `json:"client,omitempty"`
	Domain                   badoption.Listable[string]        `json:"domain,omitempty"`
	DomainSuffix             badoption.Listable[string]        `json:"domain_suffix,omitempty"`
	DomainKeyword            badoption.Listable[string]        `json:"domain_keyword,omitempty"`
	DomainRegex              badoption.Listable[string]        `json:"domain_regex,omitempty"`
	Geosite                  badoption.Listable[string]        `json:"geosite,omitempty"`
	SourceGeoIP              badoption.Listable[string]        `json:"source_geoip,omitempty"`
	GeoIP                    badoption.Listable[string]        `json:"geoip,omitempty"`
	SourceIPCIDR             badoption.Listable[string]        `json:"source_ip_cidr,omitempty"`
	SourceIPIsPrivate        bool                              `json:"source_ip_is_private,omitempty"`
	IPCIDR                   badoption.Listable[string]        `json:"ip_cidr,omitempty"`
	IPIsPrivate              bool                              `json:"ip_is_private,omitempty"`
	SourcePort               badoption.Listable[uint16]        `json:"source_port,omitempty"`
	SourcePortRange          badoption.Listable[string]        `json:"source_port_range,omitempty"`
	Port                     badoption.Listable[uint16]        `json:"port,omitempty"`
	PortRange                badoption.Listable[string]        `json:"port_range,omitempty"`
	ProcessName              badoption.Listable[string]        `json:"process_name,omitempty"`
	ProcessPath              badoption.Listable[string]        `json:"process_path,omitempty"`
	ProcessPathRegex         badoption.Listable[string]        `json:"process_path_regex,omitempty"`
	PackageName              badoption.Listable[string]        `json:"package_name,omitempty"`
	User                     badoption.Listable[string]        `json:"user,omitempty"`
	UserID                   badoption.Listable[int32]         `json:"user_id,omitempty"`
	ClashMode                string                            `json:"clash_mode,omitempty"`
	NetworkType              badoption.Listable[InterfaceType] `json:"network_type,omitempty"`
	NetworkIsExpensive       bool                              `json:"network_is_expensive,omitempty"`
	NetworkIsConstrained     bool                              `json:"network_is_constrained,omitempty"`
	WIFISSID                 badoption.Listable[string]        `json:"wifi_ssid,omitempty"`
	WIFIBSSID                badoption.Listable[string]        `json:"wifi_bssid,omitempty"`
	RuleSet                  badoption.Listable[string]        `json:"rule_set,omitempty"`
	RuleSetIPCIDRMatchSource bool                              `json:"rule_set_ip_cidr_match_source,omitempty"`
	Invert                   bool                              `json:"invert,omitempty"`

	// Deprecated: renamed to rule_set_ip_cidr_match_source
	Deprecated_RulesetIPCIDRMatchSource bool `json:"rule_set_ipcidr_match_source,omitempty"`
}

type RawLogicalDNSRule added in v1.12.4

type RawLogicalDNSRule struct {
	Mode   string    `json:"mode"`
	Rules  []DNSRule `json:"rules,omitempty"`
	Invert bool      `json:"invert,omitempty"`
}

type RawLogicalRule added in v1.12.4

type RawLogicalRule struct {
	Mode   string `json:"mode"`
	Rules  []Rule `json:"rules,omitempty"`
	Invert bool   `json:"invert,omitempty"`
}

type RawRouteOptionsActionOptions added in v1.12.4

type RawRouteOptionsActionOptions struct {
	OverrideAddress string `json:"override_address,omitempty"`
	OverridePort    uint16 `json:"override_port,omitempty"`

	NetworkStrategy *NetworkStrategy `json:"network_strategy,omitempty"`
	FallbackDelay   uint32           `json:"fallback_delay,omitempty"`

	UDPDisableDomainUnmapping bool               `json:"udp_disable_domain_unmapping,omitempty"`
	UDPConnect                bool               `json:"udp_connect,omitempty"`
	UDPTimeout                badoption.Duration `json:"udp_timeout,omitempty"`

	TLSFragment              bool               `json:"tls_fragment,omitempty"`
	TLSFragmentFallbackDelay badoption.Duration `json:"tls_fragment_fallback_delay,omitempty"`
	TLSRecordFragment        bool               `json:"tls_record_fragment,omitempty"`
}

type RedirectInboundOptions

type RedirectInboundOptions struct {
	ListenOptions
}

type RejectActionOptions added in v1.12.4

type RejectActionOptions _RejectActionOptions

func (RejectActionOptions) MarshalJSON added in v1.12.4

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

func (*RejectActionOptions) UnmarshalJSON added in v1.12.4

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

type RemoteDNSServerOptions added in v1.12.4

type RemoteDNSServerOptions struct {
	LocalDNSServerOptions
	DNSServerAddressOptions
	LegacyAddressResolver      string             `json:"-"`
	LegacyAddressStrategy      DomainStrategy     `json:"-"`
	LegacyAddressFallbackDelay badoption.Duration `json:"-"`
}

type RemoteHTTPSDNSServerOptions added in v1.12.4

type RemoteHTTPSDNSServerOptions struct {
	RemoteTLSDNSServerOptions
	Path    string               `json:"path,omitempty"`
	Method  string               `json:"method,omitempty"`
	Headers badoption.HTTPHeader `json:"headers,omitempty"`
}

type RemoteRuleSet

type RemoteRuleSet struct {
	URL            string             `json:"url"`
	DownloadDetour string             `json:"download_detour,omitempty"`
	UpdateInterval badoption.Duration `json:"update_interval,omitempty"`
}

type RemoteTLSDNSServerOptions added in v1.12.4

type RemoteTLSDNSServerOptions struct {
	RemoteDNSServerOptions
	OutboundTLSOptionsContainer
}

type ResolvedDNSServerOptions added in v1.12.4

type ResolvedDNSServerOptions struct {
	Service                string `json:"service"`
	AcceptDefaultResolvers bool   `json:"accept_default_resolvers,omitempty"`
}

type ResolvedServiceOptions added in v1.12.4

type ResolvedServiceOptions _ResolvedServiceOptions

func (ResolvedServiceOptions) MarshalJSONContext added in v1.12.4

func (r ResolvedServiceOptions) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*ResolvedServiceOptions) UnmarshalJSONContext added in v1.12.4

func (r *ResolvedServiceOptions) UnmarshalJSONContext(ctx context.Context, bytes []byte) error

type RouteActionOptions added in v1.12.4

type RouteActionOptions struct {
	Outbound string `json:"outbound,omitempty"`
	RawRouteOptionsActionOptions
}

type RouteActionResolve added in v1.12.4

type RouteActionResolve struct {
	Server       string                `json:"server,omitempty"`
	Strategy     DomainStrategy        `json:"strategy,omitempty"`
	DisableCache bool                  `json:"disable_cache,omitempty"`
	RewriteTTL   *uint32               `json:"rewrite_ttl,omitempty"`
	ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
}

type RouteActionSniff added in v1.12.4

type RouteActionSniff struct {
	Sniffer badoption.Listable[string] `json:"sniffer,omitempty"`
	Timeout badoption.Duration         `json:"timeout,omitempty"`
}

type RouteOptions

type RouteOptions struct {
	GeoIP                      *GeoIPOptions                     `json:"geoip,omitempty"`
	Geosite                    *GeositeOptions                   `json:"geosite,omitempty"`
	Rules                      []Rule                            `json:"rules,omitempty"`
	RuleSet                    []RuleSet                         `json:"rule_set,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                FwMark                            `json:"default_mark,omitempty"`
	DefaultDomainResolver      *DomainResolveOptions             `json:"default_domain_resolver,omitempty"`
	DefaultNetworkStrategy     *NetworkStrategy                  `json:"default_network_strategy,omitempty"`
	DefaultNetworkType         badoption.Listable[InterfaceType] `json:"default_network_type,omitempty"`
	DefaultFallbackNetworkType badoption.Listable[InterfaceType] `json:"default_fallback_network_type,omitempty"`
	DefaultFallbackDelay       badoption.Duration                `json:"default_fallback_delay,omitempty"`
}

type RouteOptionsActionOptions added in v1.12.4

type RouteOptionsActionOptions RawRouteOptionsActionOptions

func (*RouteOptionsActionOptions) UnmarshalJSON added in v1.12.4

func (r *RouteOptionsActionOptions) UnmarshalJSON(data []byte) error

type Rule

type Rule _Rule

func (Rule) IsValid

func (r Rule) IsValid() bool

func (Rule) MarshalJSON

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

func (*Rule) UnmarshalJSON

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

type RuleAction added in v1.12.4

type RuleAction _RuleAction

func (RuleAction) MarshalJSON added in v1.12.4

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

func (*RuleAction) UnmarshalJSON added in v1.12.4

func (r *RuleAction) UnmarshalJSON(data []byte) error

type RuleSet

type RuleSet _RuleSet

func (RuleSet) MarshalJSON

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

func (*RuleSet) UnmarshalJSON

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

type SOCKSOutboundOptions added in v1.12.4

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"`
	UDPOverTCP *UDPOverTCPOptions `json:"udp_over_tcp,omitempty"`
}

type SSHOutboundOptions

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

type SSMAPIServiceOptions added in v1.12.4

type SSMAPIServiceOptions struct {
	ListenOptions
	Servers   *badjson.TypedMap[string, string] `json:"servers"`
	CachePath string                            `json:"cache_path,omitempty"`
	InboundTLSOptionsContainer
}

type SelectorOutboundOptions

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

type ServerOptions

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

func (ServerOptions) Build

func (o ServerOptions) Build() M.Socksaddr

func (*ServerOptions) ReplaceServerOptions

func (o *ServerOptions) ReplaceServerOptions(options ServerOptions)

func (ServerOptions) ServerIsDomain added in v1.12.4

func (o ServerOptions) ServerIsDomain() bool

func (*ServerOptions) TakeServerOptions

func (o *ServerOptions) TakeServerOptions() ServerOptions

type ServerOptionsWrapper

type ServerOptionsWrapper interface {
	TakeServerOptions() ServerOptions
	ReplaceServerOptions(options ServerOptions)
}

type Service added in v1.12.4

type Service _Service

func (*Service) MarshalJSONContext added in v1.12.4

func (h *Service) MarshalJSONContext(ctx context.Context) ([]byte, error)

func (*Service) UnmarshalJSONContext added in v1.12.4

func (h *Service) UnmarshalJSONContext(ctx context.Context, content []byte) error

type ServiceOptionsRegistry added in v1.12.4

type ServiceOptionsRegistry interface {
	CreateOptions(serviceType string) (any, bool)
}

type ShadowTLSHandshakeOptions

type ShadowTLSHandshakeOptions struct {
	ServerOptions
	DialerOptions
}

type ShadowTLSInboundOptions

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 *badjson.TypedMap[string, ShadowTLSHandshakeOptions] `json:"handshake_for_server_name,omitempty"`
	StrictMode             bool                                                 `json:"strict_mode,omitempty"`
	WildcardSNI            WildcardSNI                                          `json:"wildcard_sni,omitempty"`
}

type ShadowTLSOutboundOptions

type ShadowTLSOutboundOptions struct {
	DialerOptions
	ServerOptions
	Version  int    `json:"version,omitempty"`
	Password string `json:"password,omitempty"`
	OutboundTLSOptionsContainer
}

type ShadowTLSUser

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,omitempty"`
	Users        []ShadowsocksUser        `json:"users,omitempty"`
	Destinations []ShadowsocksDestination `json:"destinations,omitempty"`
	Multiplex    *InboundMultiplexOptions `json:"multiplex,omitempty"`
	Managed      bool                     `json:"managed,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"`
	UDPOverTCP    *UDPOverTCPOptions        `json:"udp_over_tcp,omitempty"`
	Multiplex     *OutboundMultiplexOptions `json:"multiplex,omitempty"`
}

type ShadowsocksROutboundOptions

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"`
	DomainResolver *DomainResolveOptions `json:"domain_resolver,omitempty"`
}

type StubOptions added in v1.12.4

type StubOptions struct{}

type TLSTricksOptions

type TLSTricksOptions struct {
	MixedCaseSNI bool   `json:"mixedcase_sni,omitempty"`
	PaddingMode  string `json:"padding_mode,omitempty"`
	PaddingSize  string `json:"padding_size,omitempty"`
	PaddingSNI   string `json:"padding_sni,omitempty"`
}

type TProxyInboundOptions

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

type TUICInboundOptions

type TUICInboundOptions struct {
	ListenOptions
	Users             []TUICUser         `json:"users,omitempty"`
	CongestionControl string             `json:"congestion_control,omitempty"`
	AuthTimeout       badoption.Duration `json:"auth_timeout,omitempty"`
	ZeroRTTHandshake  bool               `json:"zero_rtt_handshake,omitempty"`
	Heartbeat         badoption.Duration `json:"heartbeat,omitempty"`
	InboundTLSOptionsContainer
}

type TUICOutboundOptions

type TUICOutboundOptions struct {
	DialerOptions
	ServerOptions
	UUID              string             `json:"uuid,omitempty"`
	Password          string             `json:"password,omitempty"`
	CongestionControl string             `json:"congestion_control,omitempty"`
	UDPRelayMode      string             `json:"udp_relay_mode,omitempty"`
	UDPOverStream     bool               `json:"udp_over_stream,omitempty"`
	ZeroRTTHandshake  bool               `json:"zero_rtt_handshake,omitempty"`
	Heartbeat         badoption.Duration `json:"heartbeat,omitempty"`
	Network           NetworkList        `json:"network,omitempty"`
	OutboundTLSOptionsContainer
}

type TUICUser

type TUICUser struct {
	Name     string `json:"name,omitempty"`
	UUID     string `json:"uuid,omitempty"`
	Password string `json:"password,omitempty"`
}

type TailscaleDNSServerOptions added in v1.12.4

type TailscaleDNSServerOptions struct {
	Endpoint               string `json:"endpoint,omitempty"`
	AcceptDefaultResolvers bool   `json:"accept_default_resolvers,omitempty"`
}

type TailscaleEndpointOptions added in v1.12.4

type TailscaleEndpointOptions struct {
	DialerOptions
	StateDirectory         string           `json:"state_directory,omitempty"`
	AuthKey                string           `json:"auth_key,omitempty"`
	ControlURL             string           `json:"control_url,omitempty"`
	Ephemeral              bool             `json:"ephemeral,omitempty"`
	Hostname               string           `json:"hostname,omitempty"`
	AcceptRoutes           bool             `json:"accept_routes,omitempty"`
	ExitNode               string           `json:"exit_node,omitempty"`
	ExitNodeAllowLANAccess bool             `json:"exit_node_allow_lan_access,omitempty"`
	AdvertiseRoutes        []netip.Prefix   `json:"advertise_routes,omitempty"`
	AdvertiseExitNode      bool             `json:"advertise_exit_node,omitempty"`
	UDPTimeout             UDPTimeoutCompat `json:"udp_timeout,omitempty"`
}

type TorOutboundOptions

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"`
	InboundTLSOptionsContainer
	Fallback        *ServerOptions            `json:"fallback,omitempty"`
	FallbackForALPN map[string]*ServerOptions `json:"fallback_for_alpn,omitempty"`
	Multiplex       *InboundMultiplexOptions  `json:"multiplex,omitempty"`
	Transport       *V2RayTransportOptions    `json:"transport,omitempty"`
}

type TrojanOutboundOptions

type TrojanOutboundOptions struct {
	DialerOptions
	ServerOptions
	Password string      `json:"password"`
	Network  NetworkList `json:"network,omitempty"`
	OutboundTLSOptionsContainer
	Multiplex *OutboundMultiplexOptions `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"`
	Address                badoption.Listable[netip.Prefix] `json:"address,omitempty"`
	AutoRoute              bool                             `json:"auto_route,omitempty"`
	IPRoute2TableIndex     int                              `json:"iproute2_table_index,omitempty"`
	IPRoute2RuleIndex      int                              `json:"iproute2_rule_index,omitempty"`
	AutoRedirect           bool                             `json:"auto_redirect,omitempty"`
	AutoRedirectInputMark  FwMark                           `json:"auto_redirect_input_mark,omitempty"`
	AutoRedirectOutputMark FwMark                           `json:"auto_redirect_output_mark,omitempty"`
	LoopbackAddress        badoption.Listable[netip.Addr]   `json:"loopback_address,omitempty"`
	StrictRoute            bool                             `json:"strict_route,omitempty"`
	RouteAddress           badoption.Listable[netip.Prefix] `json:"route_address,omitempty"`
	RouteAddressSet        badoption.Listable[string]       `json:"route_address_set,omitempty"`
	RouteExcludeAddress    badoption.Listable[netip.Prefix] `json:"route_exclude_address,omitempty"`
	RouteExcludeAddressSet badoption.Listable[string]       `json:"route_exclude_address_set,omitempty"`
	IncludeInterface       badoption.Listable[string]       `json:"include_interface,omitempty"`
	ExcludeInterface       badoption.Listable[string]       `json:"exclude_interface,omitempty"`
	IncludeUID             badoption.Listable[uint32]       `json:"include_uid,omitempty"`
	IncludeUIDRange        badoption.Listable[string]       `json:"include_uid_range,omitempty"`
	ExcludeUID             badoption.Listable[uint32]       `json:"exclude_uid,omitempty"`
	ExcludeUIDRange        badoption.Listable[string]       `json:"exclude_uid_range,omitempty"`
	IncludeAndroidUser     badoption.Listable[int]          `json:"include_android_user,omitempty"`
	IncludePackage         badoption.Listable[string]       `json:"include_package,omitempty"`
	ExcludePackage         badoption.Listable[string]       `json:"exclude_package,omitempty"`
	UDPTimeout             UDPTimeoutCompat                 `json:"udp_timeout,omitempty"`
	Stack                  string                           `json:"stack,omitempty"`
	Platform               *TunPlatformOptions              `json:"platform,omitempty"`
	InboundOptions

	// Deprecated: removed
	GSO bool `json:"gso,omitempty"`
	// Deprecated: merged to Address
	Inet4Address badoption.Listable[netip.Prefix] `json:"inet4_address,omitempty"`
	// Deprecated: merged to Address
	Inet6Address badoption.Listable[netip.Prefix] `json:"inet6_address,omitempty"`
	// Deprecated: merged to RouteAddress
	Inet4RouteAddress badoption.Listable[netip.Prefix] `json:"inet4_route_address,omitempty"`
	// Deprecated: merged to RouteAddress
	Inet6RouteAddress badoption.Listable[netip.Prefix] `json:"inet6_route_address,omitempty"`
	// Deprecated: merged to RouteExcludeAddress
	Inet4RouteExcludeAddress badoption.Listable[netip.Prefix] `json:"inet4_route_exclude_address,omitempty"`
	// Deprecated: merged to RouteExcludeAddress
	Inet6RouteExcludeAddress badoption.Listable[netip.Prefix] `json:"inet6_route_exclude_address,omitempty"`
	// Deprecated: removed
	EndpointIndependentNat bool `json:"endpoint_independent_nat,omitempty"`
}

type TunPlatformOptions

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

type UDPOverTCPOptions

type UDPOverTCPOptions _UDPOverTCPOptions

func (UDPOverTCPOptions) MarshalJSON

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

func (*UDPOverTCPOptions) UnmarshalJSON

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

type UDPTimeoutCompat

type UDPTimeoutCompat badoption.Duration

func (UDPTimeoutCompat) MarshalJSON

func (c UDPTimeoutCompat) MarshalJSON() ([]byte, error)

func (*UDPTimeoutCompat) UnmarshalJSON

func (c *UDPTimeoutCompat) UnmarshalJSON(data []byte) error

type URLTestOutboundOptions

type URLTestOutboundOptions struct {
	Outbounds                 []string           `json:"outbounds"`
	URL                       string             `json:"url,omitempty"`
	Interval                  badoption.Duration `json:"interval,omitempty"`
	Tolerance                 uint16             `json:"tolerance,omitempty"`
	IdleTimeout               badoption.Duration `json:"idle_timeout,omitempty"`
	InterruptExistConnections bool               `json:"interrupt_exist_connections,omitempty"`
}

type V2RayAPIOptions

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

type V2RayGRPCOptions

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

type V2RayHTTPOptions

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

type V2RayHTTPUpgradeOptions

type V2RayHTTPUpgradeOptions struct {
	Host    string               `json:"host,omitempty"`
	Path    string               `json:"path,omitempty"`
	Headers badoption.HTTPHeader `json:"headers,omitempty"`
}

type V2RayQUICOptions

type V2RayQUICOptions struct{}

type V2RayStatsServiceOptions

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

type V2RayTransportOptions _V2RayTransportOptions

func (V2RayTransportOptions) MarshalJSON

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

func (*V2RayTransportOptions) UnmarshalJSON

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

type V2RayWebsocketOptions

type V2RayWebsocketOptions struct {
	Path                string               `json:"path,omitempty"`
	Headers             badoption.HTTPHeader `json:"headers,omitempty"`
	MaxEarlyData        uint32               `json:"max_early_data,omitempty"`
	EarlyDataHeaderName string               `json:"early_data_header_name,omitempty"`
}

type VLESSInboundOptions

type VLESSInboundOptions struct {
	ListenOptions
	Users []VLESSUser `json:"users,omitempty"`
	InboundTLSOptionsContainer
	Multiplex *InboundMultiplexOptions `json:"multiplex,omitempty"`
	Transport *V2RayTransportOptions   `json:"transport,omitempty"`
}

type VLESSOutboundOptions

type VLESSOutboundOptions struct {
	DialerOptions
	ServerOptions
	UUID    string      `json:"uuid"`
	Flow    string      `json:"flow,omitempty"`
	Network NetworkList `json:"network,omitempty"`
	OutboundTLSOptionsContainer
	Multiplex      *OutboundMultiplexOptions `json:"multiplex,omitempty"`
	Transport      *V2RayTransportOptions    `json:"transport,omitempty"`
	PacketEncoding *string                   `json:"packet_encoding,omitempty"`
}

type VLESSUser

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"`
	InboundTLSOptionsContainer
	Multiplex *InboundMultiplexOptions `json:"multiplex,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"`
	OutboundTLSOptionsContainer
	PacketEncoding string                    `json:"packet_encoding,omitempty"`
	Multiplex      *OutboundMultiplexOptions `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 WildcardSNI added in v1.12.4

type WildcardSNI int
const (
	ShadowTLSWildcardSNIOff WildcardSNI = iota
	ShadowTLSWildcardSNIAuthed
	ShadowTLSWildcardSNIAll
)

func (WildcardSNI) MarshalJSON added in v1.12.4

func (w WildcardSNI) MarshalJSON() ([]byte, error)

func (WildcardSNI) String added in v1.12.4

func (w WildcardSNI) String() string

func (*WildcardSNI) UnmarshalJSON added in v1.12.4

func (w *WildcardSNI) UnmarshalJSON(bytes []byte) error

type WireGuardEndpointOptions added in v1.12.4

type WireGuardEndpointOptions struct {
	System     bool                             `json:"system,omitempty"`
	Name       string                           `json:"name,omitempty"`
	MTU        uint32                           `json:"mtu,omitempty"`
	Address    badoption.Listable[netip.Prefix] `json:"address"`
	PrivateKey string                           `json:"private_key"`
	ListenPort uint16                           `json:"listen_port,omitempty"`
	Peers      []WireGuardPeer                  `json:"peers,omitempty"`
	UDPTimeout badoption.Duration               `json:"udp_timeout,omitempty"`
	Workers    int                              `json:"workers,omitempty"`
	DialerOptions
}

type WireGuardPeer

type WireGuardPeer struct {
	Address                     string                           `json:"address,omitempty"`
	Port                        uint16                           `json:"port,omitempty"`
	PublicKey                   string                           `json:"public_key,omitempty"`
	PreSharedKey                string                           `json:"pre_shared_key,omitempty"`
	AllowedIPs                  badoption.Listable[netip.Prefix] `json:"allowed_ips,omitempty"`
	PersistentKeepaliveInterval uint16                           `json:"persistent_keepalive_interval,omitempty"`
	Reserved                    []uint8                          `json:"reserved,omitempty"`
}

Jump to

Keyboard shortcuts

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