clash

package
v0.0.0-...-07bccb4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalRawConfig

func MarshalRawConfig(cfg *RawConfig) ([]byte, error)

Types

type ConnBreakStrategy

type ConnBreakStrategy struct {
	Proxy   string `yaml:"proxy"`
	Profile bool   `yaml:"profile"`
	Mode    bool   `yaml:"mode"`
}

type DNSConfig

type DNSConfig struct {
	Enable            *bool              `yaml:"enable,omitempty"`
	IPV6              *bool              `yaml:"ipv6,omitempty"`
	PreferH3          *bool              `yaml:"prefer-h3,omitempty"`
	Listen            *string            `yaml:"listen,omitempty"`
	DefaultNameserver []string           `yaml:"default-nameserver,omitempty"`
	EnhancedMode      *string            `yaml:"enhanced-mode,omitempty"`
	FakeIPRange       *string            `yaml:"fake-ip-range,omitempty"`
	UseHosts          *bool              `yaml:"use-hosts,omitempty"`
	SearchDomains     []string           `yaml:"search-domains,omitempty"`
	FakeIPFilter      []string           `yaml:"fake-ip-filter,omitempty"`
	Nameserver        []string           `yaml:"nameserver,omitempty"`
	Fallback          []string           `yaml:"fallback,omitempty"`
	FallbackFilter    FallbackFilter     `yaml:"fallback-filter,omitempty"`
	NameserverPolicy  *map[string]string `yaml:"nameserver-policy,omitempty"`
}

type Experimental

type Experimental struct {
	UDPFallbackMatch  bool `yaml:"udp-fallback-match"`
	SniffTLSSNI       bool `yaml:"sniff-tls-sni"`
	IgnoreResolveFail bool `yaml:"ignore-resolve-fail"`
}

type FallbackFilter

type FallbackFilter struct {
	GeoIP     *bool    `yaml:"geoip,omitempty"`
	GeoIPCode *string  `yaml:"geoip-code,omitempty"`
	IPCIDR    []string `yaml:"ipcidr,omitempty"`
	Domain    []string `yaml:"domain,omitempty"`
}

type GRPCOptions

type GRPCOptions struct {
	GrpcServiceName *string `yaml:"grpc-service-name,omitempty"`
}

type HTTP2Options

type HTTP2Options struct {
	Host []string `yaml:"host,omitempty"`
	Path *string  `yaml:"path,omitempty"`
}

type HTTPOptions

type HTTPOptions struct {
	Method  *string              `yaml:"method,omitempty"`
	Path    []string             `yaml:"path,omitempty"`
	Headers *map[string][]string `yaml:"headers,omitempty"`
}

type HealthCheck

type HealthCheck struct {
	Enable         bool    `yaml:"enable"`
	URL            string  `yaml:"url"`
	Interval       int     `yaml:"interval"`
	Lazy           *bool   `yaml:"lazy,omitempty"`
	ExpectedStatus *string `yaml:"expected-status,omitempty"`
}

type Hosts

type Hosts struct {
	*ordered.Map[string, string]
}

func (Hosts) MarshalYAML

func (o Hosts) MarshalYAML() (interface{}, error)

func (*Hosts) UnmarshalYAML

func (o *Hosts) UnmarshalYAML(value *yaml.Node) error

type Inbound

type Inbound inbound

func (*Inbound) UnmarshalYAML

func (i *Inbound) UnmarshalYAML(unmarshal func(any) error) error

type InboundType

type InboundType string
const (
	InboundTypeSocks  InboundType = "socks"
	InboundTypeRedir  InboundType = "redir"
	InboundTypeTproxy InboundType = "tproxy"
	InboundTypeHTTP   InboundType = "http"
	InboundTypeMixed  InboundType = "mixed"
)

type ObfsOptions

type ObfsOptions struct {
	Mode *string `yaml:"mode,omitempty"`
	Host *string `yaml:"host,omitempty"`
}

type PluginOptions

type PluginOptions struct {
	MaxEarlyData    *int               `yaml:"max-early-data,omitempty"`
	Mode            *string            `yaml:"mode,omitempty"`
	Host            *string            `yaml:"host,omitempty"`
	Path            *string            `yaml:"path,omitempty"`
	EarlyDataHeader *string            `yaml:"early-data-header-name,omitempty"`
	ServerName      *string            `yaml:"servername,omitempty"`
	TLS             *bool              `yaml:"tls,omitempty"`
	SkipCertVerify  *bool              `yaml:"skip-cert-verify,omitempty"`
	Mux             *bool              `yaml:"mux,omitempty"`
	Headers         *map[string]string `yaml:"headers,omitempty"`
	WSOptions       WSOptions          `yaml:"ws-opts,omitempty"`
	H2Options       HTTP2Options       `yaml:"h2-opts,omitempty"`
	HTTPOptions     HTTPOptions        `yaml:"http-opts,omitempty"`
	GRPCOptions     GRPCOptions        `yaml:"grpc-opts,omitempty"`
	ObfsOptions     ObfsOptions        `yaml:"obfs-opts,omitempty"`
}

type Profile

type Profile struct {
	StoreSelected bool `yaml:"store-selected"`
	StoreFakeIP   bool `yaml:"store-fake-ip"`
	Tracing       bool `yaml:"tracing"`
}

type Proxies

type Proxies struct {
	*ordered.Map[string, Proxy]
}

func (Proxies) MarshalYAML

func (o Proxies) MarshalYAML() (interface{}, error)

func (*Proxies) UnmarshalYAML

func (o *Proxies) UnmarshalYAML(value *yaml.Node) error

type Proxy

type Proxy struct {
	Name   string `yaml:"name"`
	Type   string `yam:"type"`
	Server string `yaml:"server"`

	// basic
	TFO         *bool   `yaml:"tfo,omitempty"`
	MPTCP       *bool   `yaml:"mptcp,omitempty"`
	Interface   *string `yaml:"interface-name,omitempty"`
	RoutingMark *int    `yaml:"routing-mark,omitempty"`
	IPVersion   *string `yaml:"ip-version,omitempty"`
	DialerProxy *string `yaml:"dialer-proxy,omitempty"`

	// Port   int    `yaml:"port"`
	// Password          string         `yaml:"password"`
	Cipher            *string       `yaml:"cipher,omitempty"`
	UDP               *bool         `yaml:"udp,omitempty"`
	Plugin            *string       `yaml:"plugin,omitempty"`
	PluginOpts        PluginOptions `yaml:"plugin-opts,omitempty"`
	UDPOverTCP        *bool         `yaml:"udp-over-tcp,omitempty"`
	UDPOverTCPVersion *int          `yaml:"udp-over-tcp-version,omitempty"`
	ClientFingerprint *string       `yaml:"client-fingerprint,omitempty"`

	// ssr
	// Name          string `yaml:"name"`
	// Server        string `yaml:"server"`
	// Port          int    `yaml:"port"`
	// Password      string `yaml:"password"`
	// Cipher        string `yaml:"cipher"`
	// Obfs          string `yaml:"obfs"`
	ObfsParam *string `yaml:"obfs-param,omitempty"`
	// Protocol      string `yaml:"protocol"`
	ProtocolParam *string `yaml:"protocol-param,omitempty"`

	// sock5
	// Name           string `yaml:"name"`
	// Server         string `yaml:"server"`
	// Port           int    `yaml:"port"`
	UserName *string `yaml:"username,omitempty"`
	Password *string `yaml:"password,omitempty"`
	TLS      *bool   `yaml:"tls,omitempty"`
	// UDP            bool   `yaml:"udp,omitempty"`
	SkipCertVerify *bool   `yaml:"skip-cert-verify,omitempty"`
	Fingerprint    *string `yaml:"fingerprint,omitempty"`

	// http
	// Name           string            `yaml:"name"`
	// Server         string            `yaml:"server"`
	// Port           int               `yaml:"port"`
	// UserName       string            `yaml:"username,omitempty"`
	// Password       string            `yaml:"password,omitempty"`
	// TLS            bool              `yaml:"tls,omitempty"`
	SNI *string `yaml:"sni,omitempty"`
	// SkipCertVerify bool              `yaml:"skip-cert-verify,omitempty"`
	// Fingerprint    string            `yaml:"fingerprint,omitempty"`
	Headers *map[string]string `yaml:"headers,omitempty"`

	// vmess
	// Name                string         `yaml:"name"`
	// Server              string         `yaml:"server"`
	// Port                int            `yaml:"port"`
	UUID    *string `yaml:"uuid,omitempty"`
	AlterID *int    `yaml:"alterId,omitempty"`
	// Cipher              string         `yaml:"cipher"`
	// UDP                 bool           `yaml:"udp,omitempty"`
	Network *string `yaml:"network,omitempty"`
	// TLS                 bool           `yaml:"tls,omitempty"`
	ALPN []string `yaml:"alpn,omitempty"`
	// SkipCertVerify      bool           `yaml:"skip-cert-verify,omitempty"`
	// Fingerprint         string         `yaml:"fingerprint,omitempty"`
	ServerName          *string        `yaml:"servername,omitempty"`
	RealityOpts         RealityOptions `yaml:"reality-opts,omitempty"`
	HTTPOpts            HTTPOptions    `yaml:"http-opts,omitempty"`
	HTTP2Opts           HTTP2Options   `yaml:"h2-opts,omitempty"`
	GrpcOpts            GRPCOptions    `yaml:"grpc-opts,omitempty"`
	WSOpts              WSOptions      `yaml:"ws-opts,omitempty"`
	PacketAddr          *bool          `yaml:"packet-addr,omitempty"`
	XUDP                *bool          `yaml:"xudp,omitempty"`
	PacketEncoding      *string        `yaml:"packet-encoding,omitempty"`
	GlobalPadding       *bool          `yaml:"global-padding,omitempty"`
	AuthenticatedLength *bool          `yaml:"authenticated-length,omitempty"`

	// vless
	// Name              string            `yaml:"name"`
	// Server            string            `yaml:"server"`
	// Port              int               `yaml:"port"`
	// UUID              string            `yaml:"uuid"`
	Flow *string `yaml:"flow,omitempty"`
	// TLS               bool              `yaml:"tls,omitempty"`
	// ALPN              []string          `yaml:"alpn,omitempty"`
	// UDP               bool              `yaml:"udp,omitempty"`
	// PacketAddr        bool              `yaml:"packet-addr,omitempty"`
	// XUDP              bool              `yaml:"xudp,omitempty"`
	// PacketEncoding    string            `yaml:"packet-encoding,omitempty"`
	// Network           string            `yaml:"network,omitempty"`
	// RealityOpts       RealityOptions    `yaml:"reality-opts,omitempty"`
	// HTTPOpts          HTTPOptions       `yaml:"http-opts,omitempty"`
	// HTTP2Opts         HTTP2Options      `yaml:"h2-opts,omitempty"`
	// GrpcOpts          GrpcOptions       `yaml:"grpc-opts,omitempty"`
	// WSOpts            WSOptions         `yaml:"ws-opts,omitempty"`
	WSPath    *string            `yaml:"ws-path,omitempty"`
	WSHeaders *map[string]string `yaml:"ws-headers,omitempty"`

	//snell
	// Name     string         `yaml:"name"`
	// Server   string         `yaml:"server"`
	// Port     int            `yaml:"port"`
	Psk *string `yaml:"psk,omitempty"`
	// UDP      bool           `yaml:"udp,omitempty"`
	Version  *int        `yaml:"version,omitempty"`
	ObfsOpts ObfsOptions `yaml:"obfs-opts,omitempty"`

	// hysteria
	// Name                string   `yaml:"name"`
	// Server              string   `yaml:"server"`
	Port         *int    `yaml:"port,omitempty"`
	Ports        *string `yaml:"ports,omitempty"`
	Protocol     *string `yaml:"protocol,omitempty"`
	ObfsProtocol string  `yaml:"obfs-protocol,omitempty"` // compatible with Stash
	Up           *string `yaml:"up,omitempty"`
	UpSpeed      int     `yaml:"up-speed,omitempty"` // compatible with Stash
	Down         *string `yaml:"down,omitempty"`
	DownSpeed    int     `yaml:"down-speed,omitempty"` // compatible with Stash
	Auth         *string `yaml:"auth,omitempty"`
	AuthString   *string `yaml:"auth-str,omitempty"`
	Obfs         *string `yaml:"obfs,omitempty"`
	// SNI                 string   `yaml:"sni,omitempty"`
	// SkipCertVerify      bool     `yaml:"skip-cert-verify,omitempty"`
	// Fingerprint         string   `yaml:"fingerprint,omitempty"`
	// ALPN                []string `yaml:"alpn,omitempty"`
	CustomCA            *string `yaml:"ca,omitempty"`
	CustomCAString      *string `yaml:"ca-str,omitempty"`
	ReceiveWindowConn   *int    `yaml:"recv-window-conn,omitempty"`
	ReceiveWindow       *int    `yaml:"recv-window,omitempty"`
	DisableMTUDiscovery *bool   `yaml:"disable-mtu-discovery,omitempty"`
	FastOpen            *bool   `yaml:"fast-open,omitempty"`
	HopInterval         *int    `yaml:"hop-interval,omitempty"`

	// wireguard
	// Server       string   `yaml:"server"`
	// Port         int      `yaml:"port"`
	Ip           *string  `yaml:"ip,omitempty"`
	Ipv6         *string  `yaml:"ipv6,omitempty"`
	PublicKey    *string  `yaml:"public-key,omitempty"`
	PreSharedKey *string  `yaml:"pre-shared-key,omitempty"`
	Reserved     []uint8  `yaml:"reserved,omitempty"`
	AllowedIPs   []string `yaml:"allowed-ips,omitempty"`
	// Name                string `yaml:"name"`
	PrivateKey *string `yaml:"private-key,omitempty"`
	Workers    *int    `yaml:"workers,omitempty"`
	MTU        *int    `yaml:"mtu,omitempty"`
	// UDP                 bool   `yaml:"udp,omitempty"`
	PersistentKeepalive *int                  `yaml:"persistent-keepalive,omitempty"`
	Peers               []WireGuardPeerOption `yaml:"peers,omitempty"`
	RemoteDnsResolve    *bool                 `yaml:"remote-dns-resolve,omitempty"`
	Dns                 []string              `yaml:"dns,omitempty"`

	// tuic
	// Name                  string   `yaml:"name"`
	// Server                string   `yaml:"server"`
	// Port                  int      `yaml:"port"`
	Token *string `yaml:"token,omitempty"`
	// UUID                  string   `yaml:"uuid,omitempty"`
	// Password              string   `yaml:"password,omitempty"`
	// Ip                    string   `yaml:"ip,omitempty"`
	HeartbeatInterval *int `yaml:"heartbeat-interval,omitempty"`
	// ALPN                  []string `yaml:"alpn,omitempty"`
	ReduceRtt             *bool   `yaml:"reduce-rtt,omitempty"`
	RequestTimeout        *int    `yaml:"request-timeout,omitempty"`
	UdpRelayMode          *string `yaml:"udp-relay-mode,omitempty"`
	CongestionController  *string `yaml:"congestion-controller,omitempty"`
	DisableSni            *bool   `yaml:"disable-sni,omitempty"`
	MaxUdpRelayPacketSize *int    `yaml:"max-udp-relay-packet-size,omitempty"`

	// FastOpen             bool   `yaml:"fast-open,omitempty"`
	MaxOpenStreams *int `yaml:"max-open-streams,omitempty"`
	CWND           *int `yaml:"cwnd,omitempty"`
	// SkipCertVerify       bool   `yaml:"skip-cert-verify,omitempty"`
	// Fingerprint          string `yaml:"fingerprint,omitempty"`
	// CustomCA             string `yaml:"ca,omitempty"`
	// CustomCAString       string `yaml:"ca-str,omitempty"`
	// ReceiveWindowConn    int    `yaml:"recv-window-conn,omitempty"`
	// ReceiveWindow        int    `yaml:"recv-window,omitempty"`
	// DisableMTUDiscovery  bool   `yaml:"disable-mtu-discovery,omitempty"`
	MaxDatagramFrameSize *int `yaml:"max-datagram-frame-size,omitempty"`

	UDPOverStream        *bool `yaml:"udp-over-stream,omitempty"`
	UDPOverStreamVersion *int  `yaml:"udp-over-stream-version,omitempty"`
}

type ProxyGroup

type ProxyGroup struct {
	Name           string   `yaml:"name"`
	Type           string   `yaml:"type"`
	Proxies        []string `yaml:"proxies,omitempty"`
	Use            []string `yaml:"use,omitempty"`
	URL            *string  `yaml:"url,omitempty"`
	Tolerance      *int     `yaml:"tolerance,omitempty"`
	Strategy       *string  `yaml:"strategy,omitempty"`
	Interval       *int     `yaml:"interval,omitempty"`
	Lazy           *bool    `yaml:"lazy,omitempty"`
	DisableUDP     *bool    `yaml:"disable-udp,omitempty"`
	Filter         *string  `yaml:"filter,omitempty"`
	ExcludeFilter  *string  `yaml:"exclude-filter,omitempty"`
	ExcludeType    *string  `yaml:"exclude-type,omitempty"`
	ExpectedStatus *string  `yaml:"expected-status,omitempty"`

	// basic
	TFO         *bool   `yaml:"tfo,omitempty"`
	MPTCP       *bool   `yaml:"mptcp,omitempty"`
	Interface   *string `yaml:"interface-name,omitempty"`
	RoutingMark *int    `yaml:"routing-mark,omitempty"`
	IPVersion   *string `yaml:"ip-version,omitempty"`
	DialerProxy *string `yaml:"dialer-proxy,omitempty"`
}

type ProxyGroups

type ProxyGroups struct {
	*ordered.Map[string, ProxyGroup]
}

func (ProxyGroups) MarshalYAML

func (o ProxyGroups) MarshalYAML() (interface{}, error)

func (*ProxyGroups) UnmarshalYAML

func (o *ProxyGroups) UnmarshalYAML(value *yaml.Node) error

type ProxyProvider

type ProxyProvider struct {
	Type          string      `yaml:"type"`
	Path          *string     `yaml:"path,omitempty"`
	URL           *string     `yaml:"url,omitempty"`
	Interval      *int        `yaml:"interval,omitempty"`
	Filter        *string     `yaml:"filter,omitempty"`
	ExcludeFilter *string     `yaml:"exclude-filter,omitempty"`
	ExcludeType   *string     `yaml:"exclude-type,omitempty"`
	DialerProxy   *string     `yaml:"dialer-proxy,omitempty"`
	HealthCheck   HealthCheck `yaml:"health-check,omitempty"`
}

type ProxyProviders

type ProxyProviders struct {
	*ordered.Map[string, ProxyProvider]
}

func (ProxyProviders) MarshalYAML

func (o ProxyProviders) MarshalYAML() (interface{}, error)

func (*ProxyProviders) UnmarshalYAML

func (o *ProxyProviders) UnmarshalYAML(value *yaml.Node) error

type RawConfig

type RawConfig struct {
	Port                 *int              `yaml:"port,omitempty"`
	SocksPort            *int              `yaml:"socks-port,omitempty"`
	RedirPort            *int              `yaml:"redir-port,omitempty"`
	TproxyPort           *int              `yaml:"tproxy-port,omitempty"`
	MixedPort            *int              `yaml:"mixed-port,omitempty"`
	Authentication       []string          `yaml:"authentication,omitempty"`
	AllowLan             *bool             `yaml:"allow-lan,omitempty"`
	BindAddress          *string           `yaml:"bind-address,omitempty"`
	Mode                 *string           `yaml:"mode,omitempty"`
	LogLevel             *string           `yaml:"log-level,omitempty"`
	IPV6                 *bool             `yaml:"ipv6,omitempty"`
	ExternalController   *string           `yaml:"external-controller,omitempty"`
	ExternalUI           *string           `yaml:"external-ui,omitempty"`
	Secret               *string           `yaml:"secret,omitempty"`
	InterfaceName        *string           `yaml:"interface-name,omitempty"`
	RoutingMark          *int              `yaml:"routing-mark,omitempty"`
	Hosts                Hosts             `yaml:"hosts,omitempty"`
	Profile              Profile           `yaml:"profile,omitempty"`
	DNS                  DNSConfig         `yaml:"dns,omitempty"`
	Experimental         Experimental      `yaml:"experimental,omitempty"`
	CFWLatencyTimeout    *int              `yaml:"cfw-latency-timeout,omitempty"`
	CFWLatencyURL        *string           `yaml:"cfw-latency-url,omitempty"`
	CFWConnBreakStrategy ConnBreakStrategy `yaml:"cfw-conn-break-strategy,omitempty"`
	CFWBypass            []string          `yaml:"cfw-bypass,omitempty"`
	Proxies              Proxies           `yaml:"proxies,omitempty"`
	ProxyGroup           ProxyGroups       `yaml:"proxy-groups,omitempty"`
	ProxyProviders       ProxyProviders    `yaml:"proxy-providers,omitempty"`
	Script               Script            `yaml:"script,omitempty"`
	RuleProviders        RuleProviders     `yaml:"rule-providers,omitempty"`
	Inbounds             []Inbound         `yaml:"inbounds,omitempty"`
	Tunnels              []Tunnel          `yaml:"tunnels,omitempty"`
	Rule                 []string          `yaml:"rules,omitempty"`
}

func UnmarshalRawConfig

func UnmarshalRawConfig(buf []byte) (*RawConfig, error)

type RealityOptions

type RealityOptions struct {
	PublicKey string `yaml:"public-key"`
	ShortID   string `yaml:"short-id"`
}

type RuleProvider

type RuleProvider struct {
	Type     string  `provider:"type"`
	Behavior string  `provider:"behavior"`
	Path     *string `provider:"path,omitempty"`
	URL      *string `provider:"url,omitempty"`
	Format   *string `provider:"format,omitempty"`
	Interval *int    `provider:"interval,omitempty"`
}

type RuleProviders

type RuleProviders struct {
	*ordered.Map[string, RuleProvider]
}

func (RuleProviders) MarshalYAML

func (o RuleProviders) MarshalYAML() (interface{}, error)

func (*RuleProviders) UnmarshalYAML

func (o *RuleProviders) UnmarshalYAML(value *yaml.Node) error

type Script

type Script struct {
	Code   string `yaml:"code,omitempty"`
	Engine string `yaml:"engine,omitempty"`
	// TODO change type to ordered.Map
	Shortcuts map[string]string `yaml:"shortcuts,omitempty"`
}

type Tunnel

type Tunnel tunnel

func (*Tunnel) BLength

func (t *Tunnel) BLength() int

func (Tunnel) MarshalYAML

func (t Tunnel) MarshalYAML() (interface{}, error)

func (*Tunnel) UnmarshalYAML

func (t *Tunnel) UnmarshalYAML(value *yaml.Node) error

type WSOptions

type WSOptions struct {
	Path    *string            `yaml:"path,omitempty"`
	Headers *map[string]string `yaml:"headers,omitempty"`
}

type WireGuardPeerOption

type WireGuardPeerOption struct {
	Server       string   `yaml:"server"`
	Port         int      `yaml:"port"`
	Ip           *string  `yaml:"ip,omitempty"`
	Ipv6         *string  `yaml:"ipv6,omitempty"`
	PublicKey    *string  `yaml:"public-key,omitempty"`
	PreSharedKey *string  `yaml:"pre-shared-key,omitempty"`
	Reserved     []uint8  `yaml:"reserved,omitempty"`
	AllowedIPs   []string `yaml:"allowed-ips,omitempty"`
}

Jump to

Keyboard shortcuts

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