option

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: GPL-2.0 Imports: 15 Imported by: 122

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshallObjects

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

func MergeObjects

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

func ParseTLSVersion

func ParseTLSVersion(version string) (uint16, error)

func ToMap

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

func UnmarshallExcluded

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

Types

type ClashAPIOptions

type ClashAPIOptions struct {
	ExternalController string `json:"external_controller,omitempty"`
	ExternalUI         string `json:"external_ui,omitempty"`
	Secret             string `json:"secret,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 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"`
	Detour               string         `json:"detour,omitempty"`
}

type DefaultDNSRule

type DefaultDNSRule struct {
	Inbound         Listable[string] `json:"inbound,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"`
	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"`
	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"`
	PackageName     Listable[string] `json:"package_name,omitempty"`
	User            Listable[string] `json:"user,omitempty"`
	UserID          Listable[int32]  `json:"user_id,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"`
	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"`
}

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 {
	OutboundDialerOptions
	OverrideAddress string `json:"override_address,omitempty"`
	OverridePort    uint16 `json:"override_port,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"`
}

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 {
	OutboundDialerOptions
	ServerOptions
	Username   string              `json:"username,omitempty"`
	Password   string              `json:"password,omitempty"`
	TLSOptions *OutboundTLSOptions `json:"tls,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 InboundOptions

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

type InboundTLSOptions

type InboundTLSOptions struct {
	Enabled         bool     `json:"enabled,omitempty"`
	ServerName      string   `json:"server_name,omitempty"`
	ALPN            []string `json:"alpn,omitempty"`
	MinVersion      string   `json:"min_version,omitempty"`
	MaxVersion      string   `json:"max_version,omitempty"`
	CipherSuites    []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"`
}

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 (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"`
	ListenPort  uint16        `json:"listen_port,omitempty"`
	TCPFastOpen bool          `json:"tcp_fast_open,omitempty"`
	UDPTimeout  int64         `json:"udp_timeout,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 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 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 OutboundDialerOptions

type OutboundDialerOptions struct {
	DialerOptions
	DomainStrategy DomainStrategy `json:"domain_strategy,omitempty"`
	FallbackDelay  Duration       `json:"fallback_delay,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            []string `json:"alpn,omitempty"`
	MinVersion      string   `json:"min_version,omitempty"`
	MaxVersion      string   `json:"max_version,omitempty"`
	CipherSuites    []string `json:"cipher_suites,omitempty"`
	Certificate     string   `json:"certificate,omitempty"`
	CertificatePath string   `json:"certificate_path,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"`
	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 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 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"`
	ControlPassword string                   `json:"control_password,omitempty"`
	Users           []ShadowsocksUser        `json:"users,omitempty"`
	Destinations    []ShadowsocksDestination `json:"destinations,omitempty"`
}

type ShadowsocksOutboundOptions

type ShadowsocksOutboundOptions struct {
	OutboundDialerOptions
	ServerOptions
	Method           string            `json:"method"`
	Password         string            `json:"password"`
	Network          NetworkList       `json:"network,omitempty"`
	UoT              bool              `json:"udp_over_tcp,omitempty"`
	MultiplexOptions *MultiplexOptions `json:"multiplex,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 {
	OutboundDialerOptions
	ServerOptions
	Version  string      `json:"version,omitempty"`
	Username string      `json:"username,omitempty"`
	Password string      `json:"password,omitempty"`
	Network  NetworkList `json:"network,omitempty"`
	UoT      bool        `json:"udp_over_tcp,omitempty"`
}

type TProxyInboundOptions

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

type TrojanInboundOptions

type TrojanInboundOptions struct {
	ListenOptions
	Users []TrojanUser       `json:"users,omitempty"`
	TLS   *InboundTLSOptions `json:"tls,omitempty"`
}

type TrojanOutboundOptions

type TrojanOutboundOptions struct {
	OutboundDialerOptions
	ServerOptions
	Password         string              `json:"password"`
	Network          NetworkList         `json:"network,omitempty"`
	TLSOptions       *OutboundTLSOptions `json:"tls,omitempty"`
	MultiplexOptions *MultiplexOptions   `json:"multiplex,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           *ListenPrefix `json:"inet4_address,omitempty"`
	Inet6Address           *ListenPrefix `json:"inet6_address,omitempty"`
	AutoRoute              bool          `json:"auto_route,omitempty"`
	EndpointIndependentNat bool          `json:"endpoint_independent_nat,omitempty"`
	UDPTimeout             int64         `json:"udp_timeout,omitempty"`
	Stack                  string        `json:"stack,omitempty"`
	InboundOptions
}

type VMessInboundOptions

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

type VMessOutboundOptions

type VMessOutboundOptions struct {
	OutboundDialerOptions
	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"`
	TLSOptions          *OutboundTLSOptions `json:"tls,omitempty"`
	MultiplexOptions    *MultiplexOptions   `json:"multiplex,omitempty"`
}

type VMessUser

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

Jump to

Keyboard shortcuts

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