v4

package
v5.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 76 Imported by: 6

Documentation

Index

Constants

View Source
const (
	AuthMethodNoAuth   = "noauth"
	AuthMethodUserPass = "password"
)

Variables

This section is empty.

Functions

func PostProcessConfigureFile

func PostProcessConfigureFile(conf *Config) error

func RegisterConfigureFilePostProcessingStage

func RegisterConfigureFilePostProcessingStage(name string, stage ConfigureFilePostProcessingStage)

Types

type APIConfig

type APIConfig struct {
	Tag      string   `json:"tag"`
	Services []string `json:"services"`
}

func (*APIConfig) Build

func (c *APIConfig) Build() (*commander.Config, error)

type Authenticator

type Authenticator struct {
	Request  AuthenticatorRequest  `json:"request"`
	Response AuthenticatorResponse `json:"response"`
}

func (*Authenticator) Build

func (v *Authenticator) Build() (proto.Message, error)

type AuthenticatorRequest

type AuthenticatorRequest struct {
	Version string                           `json:"version"`
	Method  string                           `json:"method"`
	Path    cfgcommon.StringList             `json:"path"`
	Headers map[string]*cfgcommon.StringList `json:"headers"`
}

func (*AuthenticatorRequest) Build

type AuthenticatorResponse

type AuthenticatorResponse struct {
	Version string                           `json:"version"`
	Status  string                           `json:"status"`
	Reason  string                           `json:"reason"`
	Headers map[string]*cfgcommon.StringList `json:"headers"`
}

func (*AuthenticatorResponse) Build

type BlackholeConfig

type BlackholeConfig struct {
	Response json.RawMessage `json:"response"`
}

func (*BlackholeConfig) Build

func (v *BlackholeConfig) Build() (proto.Message, error)

type BridgeConfig

type BridgeConfig struct {
	Tag    string `json:"tag"`
	Domain string `json:"domain"`
}

func (*BridgeConfig) Build

func (c *BridgeConfig) Build() (*reverse.BridgeConfig, error)

type BrowserForwarderConfig

type BrowserForwarderConfig struct {
	ListenAddr string `json:"listenAddr"`
	ListenPort int32  `json:"listenPort"`
}

func (*BrowserForwarderConfig) Build

func (b *BrowserForwarderConfig) Build() (proto.Message, error)

type BurstObservatoryConfig

type BurstObservatoryConfig struct {
	SubjectSelector []string `json:"subjectSelector"`
	// health check settings
	HealthCheck *router.HealthCheckSettings `json:"pingConfig,omitempty"`
}

func (BurstObservatoryConfig) Build

type Config

type Config struct {
	// Port of this Point server.
	// Deprecated: Port exists for historical compatibility
	// and should not be used.
	Port uint16 `json:"port"`

	// Deprecated: InboundConfig exists for historical compatibility
	// and should not be used.
	InboundConfig *InboundDetourConfig `json:"inbound"`

	// Deprecated: OutboundConfig exists for historical compatibility
	// and should not be used.
	OutboundConfig *OutboundDetourConfig `json:"outbound"`

	// Deprecated: InboundDetours exists for historical compatibility
	// and should not be used.
	InboundDetours []InboundDetourConfig `json:"inboundDetour"`

	// Deprecated: OutboundDetours exists for historical compatibility
	// and should not be used.
	OutboundDetours []OutboundDetourConfig `json:"outboundDetour"`

	LogConfig        *log.LogConfig          `json:"log"`
	RouterConfig     *router.RouterConfig    `json:"routing"`
	DNSConfig        *dns.DNSConfig          `json:"dns"`
	InboundConfigs   []InboundDetourConfig   `json:"inbounds"`
	OutboundConfigs  []OutboundDetourConfig  `json:"outbounds"`
	Transport        *TransportConfig        `json:"transport"`
	Policy           *PolicyConfig           `json:"policy"`
	API              *APIConfig              `json:"api"`
	Stats            *StatsConfig            `json:"stats"`
	Reverse          *ReverseConfig          `json:"reverse"`
	FakeDNS          *dns.FakeDNSConfig      `json:"fakeDns"`
	BrowserForwarder *BrowserForwarderConfig `json:"browserForwarder"`
	Observatory      *ObservatoryConfig      `json:"observatory"`
	BurstObservatory *BurstObservatoryConfig `json:"burstObservatory"`
	MultiObservatory *MultiObservatoryConfig `json:"multiObservatory"`

	Services map[string]*json.RawMessage `json:"services"`
}

func (*Config) Build

func (c *Config) Build() (*core.Config, error)

Build implements Buildable.

func (*Config) BuildServices

func (c *Config) BuildServices(service map[string]*json.RawMessage) ([]*anypb.Any, error)

type ConfigureFilePostProcessingStage

type ConfigureFilePostProcessingStage interface {
	Process(conf *Config) error
}

type DNSOutboundConfig

type DNSOutboundConfig struct {
	Network   cfgcommon.Network  `json:"network"`
	Address   *cfgcommon.Address `json:"address"`
	Port      uint16             `json:"port"`
	UserLevel uint32             `json:"userLevel"`
}

func (*DNSOutboundConfig) Build

func (c *DNSOutboundConfig) Build() (proto.Message, error)

type DTLSAuthenticator

type DTLSAuthenticator struct{}

func (DTLSAuthenticator) Build

func (DTLSAuthenticator) Build() (proto.Message, error)

type DokodemoConfig

type DokodemoConfig struct {
	Host         *cfgcommon.Address     `json:"address"`
	PortValue    uint16                 `json:"port"`
	NetworkList  *cfgcommon.NetworkList `json:"network"`
	TimeoutValue uint32                 `json:"timeout"`
	Redirect     bool                   `json:"followRedirect"`
	UserLevel    uint32                 `json:"userLevel"`
}

func (*DokodemoConfig) Build

func (v *DokodemoConfig) Build() (proto.Message, error)

type DomainSocketConfig

type DomainSocketConfig struct {
	Path     string `json:"path"`
	Abstract bool   `json:"abstract"`
	Padding  bool   `json:"padding"`
}

func (*DomainSocketConfig) Build

func (c *DomainSocketConfig) Build() (proto.Message, error)

Build implements Buildable.

type FeaturesConfig

type FeaturesConfig struct {
	Detour *VMessDetourConfig `json:"detour"`
}

type FreedomConfig

type FreedomConfig struct {
	DomainStrategy string  `json:"domainStrategy"`
	Timeout        *uint32 `json:"timeout"`
	Redirect       string  `json:"redirect"`
	UserLevel      uint32  `json:"userLevel"`
}

func (*FreedomConfig) Build

func (c *FreedomConfig) Build() (proto.Message, error)

Build implements Buildable

type GunConfig

type GunConfig struct {
	ServiceName string `json:"serviceName"`
}

func (GunConfig) Build

func (g GunConfig) Build() (proto.Message, error)

type HTTPAccount

type HTTPAccount struct {
	Username string `json:"user"`
	Password string `json:"pass"`
}

func (*HTTPAccount) Build

func (v *HTTPAccount) Build() *http.Account

type HTTPClientConfig

type HTTPClientConfig struct {
	Servers []*HTTPRemoteConfig `json:"servers"`
}

func (*HTTPClientConfig) Build

func (v *HTTPClientConfig) Build() (proto.Message, error)

type HTTPConfig

type HTTPConfig struct {
	Host    *cfgcommon.StringList            `json:"host"`
	Path    string                           `json:"path"`
	Method  string                           `json:"method"`
	Headers map[string]*cfgcommon.StringList `json:"headers"`
}

func (*HTTPConfig) Build

func (c *HTTPConfig) Build() (proto.Message, error)

Build implements Buildable.

type HTTPRemoteConfig

type HTTPRemoteConfig struct {
	Address *cfgcommon.Address `json:"address"`
	Port    uint16             `json:"port"`
	Users   []json.RawMessage  `json:"users"`
}

type HTTPResponse

type HTTPResponse struct{}

func (*HTTPResponse) Build

func (*HTTPResponse) Build() (proto.Message, error)

type HTTPServerConfig

type HTTPServerConfig struct {
	Timeout     uint32         `json:"timeout"`
	Accounts    []*HTTPAccount `json:"accounts"`
	Transparent bool           `json:"allowTransparent"`
	UserLevel   uint32         `json:"userLevel"`
}

func (*HTTPServerConfig) Build

func (c *HTTPServerConfig) Build() (proto.Message, error)

type InboundDetourAllocationConfig

type InboundDetourAllocationConfig struct {
	Strategy    string  `json:"strategy"`
	Concurrency *uint32 `json:"concurrency"`
	RefreshMin  *uint32 `json:"refresh"`
}

func (*InboundDetourAllocationConfig) Build

Build implements Buildable.

type InboundDetourConfig

type InboundDetourConfig struct {
	Protocol       string                         `json:"protocol"`
	PortRange      *cfgcommon.PortRange           `json:"port"`
	ListenOn       *cfgcommon.Address             `json:"listen"`
	Settings       *json.RawMessage               `json:"settings"`
	Tag            string                         `json:"tag"`
	Allocation     *InboundDetourAllocationConfig `json:"allocate"`
	StreamSetting  *StreamConfig                  `json:"streamSettings"`
	DomainOverride *cfgcommon.StringList          `json:"domainOverride"`
	SniffingConfig *sniffer.SniffingConfig        `json:"sniffing"`
}

func (*InboundDetourConfig) Build

Build implements Buildable.

type KCPConfig

type KCPConfig struct {
	Mtu             *uint32         `json:"mtu"`
	Tti             *uint32         `json:"tti"`
	UpCap           *uint32         `json:"uplinkCapacity"`
	DownCap         *uint32         `json:"downlinkCapacity"`
	Congestion      *bool           `json:"congestion"`
	ReadBufferSize  *uint32         `json:"readBufferSize"`
	WriteBufferSize *uint32         `json:"writeBufferSize"`
	HeaderConfig    json.RawMessage `json:"header"`
	Seed            *string         `json:"seed"`
}

func (*KCPConfig) Build

func (c *KCPConfig) Build() (proto.Message, error)

Build implements Buildable.

type LoopbackConfig

type LoopbackConfig struct {
	InboundTag string `json:"inboundTag"`
}

func (LoopbackConfig) Build

func (l LoopbackConfig) Build() (proto.Message, error)

type MultiObservatoryConfig

type MultiObservatoryConfig struct {
	Observers []MultiObservatoryItem `json:"observers"`
}

func (*MultiObservatoryConfig) Build

func (o *MultiObservatoryConfig) Build() (proto.Message, error)

type MultiObservatoryItem

type MultiObservatoryItem struct {
	MemberType string          `json:"type"`
	Tag        string          `json:"tag"`
	Value      json.RawMessage `json:"settings"`
}

type NoOpAuthenticator

type NoOpAuthenticator struct{}

func (NoOpAuthenticator) Build

func (NoOpAuthenticator) Build() (proto.Message, error)

type NoOpConnectionAuthenticator

type NoOpConnectionAuthenticator struct{}

func (NoOpConnectionAuthenticator) Build

type NoneResponse

type NoneResponse struct{}

func (*NoneResponse) Build

func (*NoneResponse) Build() (proto.Message, error)

type ObservatoryConfig

type ObservatoryConfig struct {
	SubjectSelector []string          `json:"subjectSelector"`
	ProbeURL        string            `json:"probeURL"`
	ProbeInterval   duration.Duration `json:"probeInterval"`
}

func (*ObservatoryConfig) Build

func (o *ObservatoryConfig) Build() (proto.Message, error)

type OutboundDetourConfig

type OutboundDetourConfig struct {
	Protocol       string                `json:"protocol"`
	SendThrough    *cfgcommon.Address    `json:"sendThrough"`
	Tag            string                `json:"tag"`
	Settings       *json.RawMessage      `json:"settings"`
	StreamSetting  *StreamConfig         `json:"streamSettings"`
	ProxySettings  *proxycfg.ProxyConfig `json:"proxySettings"`
	MuxSettings    *muxcfg.MuxConfig     `json:"mux"`
	DomainStrategy string                `json:"domainStrategy"`
}

func (*OutboundDetourConfig) Build

Build implements Buildable.

type Policy

type Policy struct {
	Handshake         *uint32 `json:"handshake"`
	ConnectionIdle    *uint32 `json:"connIdle"`
	UplinkOnly        *uint32 `json:"uplinkOnly"`
	DownlinkOnly      *uint32 `json:"downlinkOnly"`
	StatsUserUplink   bool    `json:"statsUserUplink"`
	StatsUserDownlink bool    `json:"statsUserDownlink"`
	BufferSize        *int32  `json:"bufferSize"`
}

func (*Policy) Build

func (t *Policy) Build() (*policy.Policy, error)

type PolicyConfig

type PolicyConfig struct {
	Levels map[uint32]*Policy `json:"levels"`
	System *SystemPolicy      `json:"system"`
}

func (*PolicyConfig) Build

func (c *PolicyConfig) Build() (*policy.Config, error)

type PortalConfig

type PortalConfig struct {
	Tag    string `json:"tag"`
	Domain string `json:"domain"`
}

func (*PortalConfig) Build

func (c *PortalConfig) Build() (*reverse.PortalConfig, error)

type QUICConfig

type QUICConfig struct {
	Header   json.RawMessage `json:"header"`
	Security string          `json:"security"`
	Key      string          `json:"key"`
}

func (*QUICConfig) Build

func (c *QUICConfig) Build() (proto.Message, error)

Build implements Buildable.

type ReverseConfig

type ReverseConfig struct {
	Bridges []BridgeConfig `json:"bridges"`
	Portals []PortalConfig `json:"portals"`
}

func (*ReverseConfig) Build

func (c *ReverseConfig) Build() (proto.Message, error)

type SRTPAuthenticator

type SRTPAuthenticator struct{}

func (SRTPAuthenticator) Build

func (SRTPAuthenticator) Build() (proto.Message, error)

type ShadowsocksClientConfig

type ShadowsocksClientConfig struct {
	Servers []*ShadowsocksServerTarget `json:"servers"`
}

func (*ShadowsocksClientConfig) Build

type ShadowsocksServerConfig

type ShadowsocksServerConfig struct {
	Cipher      string                 `json:"method"`
	Password    string                 `json:"password"`
	UDP         bool                   `json:"udp"`
	Level       byte                   `json:"level"`
	Email       string                 `json:"email"`
	NetworkList *cfgcommon.NetworkList `json:"network"`
	IVCheck     bool                   `json:"ivCheck"`
}

func (*ShadowsocksServerConfig) Build

type ShadowsocksServerTarget

type ShadowsocksServerTarget struct {
	Address  *cfgcommon.Address `json:"address"`
	Port     uint16             `json:"port"`
	Cipher   string             `json:"method"`
	Password string             `json:"password"`
	Email    string             `json:"email"`
	Ota      bool               `json:"ota"`
	Level    byte               `json:"level"`
	IVCheck  bool               `json:"ivCheck"`
}

type SocksAccount

type SocksAccount struct {
	Username string `json:"user"`
	Password string `json:"pass"`
}

func (*SocksAccount) Build

func (v *SocksAccount) Build() *socks.Account

type SocksClientConfig

type SocksClientConfig struct {
	Servers []*SocksRemoteConfig `json:"servers"`
	Version string               `json:"version"`
}

func (*SocksClientConfig) Build

func (v *SocksClientConfig) Build() (proto.Message, error)

type SocksRemoteConfig

type SocksRemoteConfig struct {
	Address *cfgcommon.Address `json:"address"`
	Port    uint16             `json:"port"`
	Users   []json.RawMessage  `json:"users"`
}

type SocksServerConfig

type SocksServerConfig struct {
	AuthMethod string             `json:"auth"`
	Accounts   []*SocksAccount    `json:"accounts"`
	UDP        bool               `json:"udp"`
	Host       *cfgcommon.Address `json:"ip"`
	Timeout    uint32             `json:"timeout"`
	UserLevel  uint32             `json:"userLevel"`
}

func (*SocksServerConfig) Build

func (v *SocksServerConfig) Build() (proto.Message, error)

type StatsConfig

type StatsConfig struct{}

func (*StatsConfig) Build

func (c *StatsConfig) Build() (*stats.Config, error)

Build implements Buildable.

type StreamConfig

type StreamConfig struct {
	Network        *TransportProtocol      `json:"network"`
	Security       string                  `json:"security"`
	TLSSettings    *tlscfg.TLSConfig       `json:"tlsSettings"`
	TCPSettings    *TCPConfig              `json:"tcpSettings"`
	KCPSettings    *KCPConfig              `json:"kcpSettings"`
	WSSettings     *WebSocketConfig        `json:"wsSettings"`
	HTTPSettings   *HTTPConfig             `json:"httpSettings"`
	DSSettings     *DomainSocketConfig     `json:"dsSettings"`
	QUICSettings   *QUICConfig             `json:"quicSettings"`
	GunSettings    *GunConfig              `json:"gunSettings"`
	GRPCSettings   *GunConfig              `json:"grpcSettings"`
	SocketSettings *socketcfg.SocketConfig `json:"sockopt"`
}

func (*StreamConfig) Build

func (c *StreamConfig) Build() (*internet.StreamConfig, error)

Build implements Buildable.

type SystemPolicy

type SystemPolicy struct {
	StatsInboundUplink    bool `json:"statsInboundUplink"`
	StatsInboundDownlink  bool `json:"statsInboundDownlink"`
	StatsOutboundUplink   bool `json:"statsOutboundUplink"`
	StatsOutboundDownlink bool `json:"statsOutboundDownlink"`
	OverrideAccessLogDest bool `json:"overrideAccessLogDest"`
}

func (*SystemPolicy) Build

func (p *SystemPolicy) Build() (*policy.SystemPolicy, error)

type TCPConfig

type TCPConfig struct {
	HeaderConfig        json.RawMessage `json:"header"`
	AcceptProxyProtocol bool            `json:"acceptProxyProtocol"`
}

func (*TCPConfig) Build

func (c *TCPConfig) Build() (proto.Message, error)

Build implements Buildable.

type TransportConfig

type TransportConfig struct {
	TCPConfig  *TCPConfig          `json:"tcpSettings"`
	KCPConfig  *KCPConfig          `json:"kcpSettings"`
	WSConfig   *WebSocketConfig    `json:"wsSettings"`
	HTTPConfig *HTTPConfig         `json:"httpSettings"`
	DSConfig   *DomainSocketConfig `json:"dsSettings"`
	QUICConfig *QUICConfig         `json:"quicSettings"`
	GunConfig  *GunConfig          `json:"gunSettings"`
	GRPCConfig *GunConfig          `json:"grpcSettings"`
}

func (*TransportConfig) Build

func (c *TransportConfig) Build() (*transport.Config, error)

Build implements Buildable.

type TransportProtocol

type TransportProtocol string

func (TransportProtocol) Build

func (p TransportProtocol) Build() (string, error)

Build implements Buildable.

type TrojanClientConfig

type TrojanClientConfig struct {
	Servers []*TrojanServerTarget `json:"servers"`
}

TrojanClientConfig is configuration of trojan servers

func (*TrojanClientConfig) Build

func (c *TrojanClientConfig) Build() (proto.Message, error)

Build implements Buildable

type TrojanInboundFallback

type TrojanInboundFallback struct {
	Alpn string          `json:"alpn"`
	Path string          `json:"path"`
	Type string          `json:"type"`
	Dest json.RawMessage `json:"dest"`
	Xver uint64          `json:"xver"`
}

TrojanInboundFallback is fallback configuration

type TrojanServerConfig

type TrojanServerConfig struct {
	Clients   []*TrojanUserConfig      `json:"clients"`
	Fallback  json.RawMessage          `json:"fallback"`
	Fallbacks []*TrojanInboundFallback `json:"fallbacks"`
}

TrojanServerConfig is Inbound configuration

func (*TrojanServerConfig) Build

func (c *TrojanServerConfig) Build() (proto.Message, error)

Build implements Buildable

type TrojanServerTarget

type TrojanServerTarget struct {
	Address  *cfgcommon.Address `json:"address"`
	Port     uint16             `json:"port"`
	Password string             `json:"password"`
	Email    string             `json:"email"`
	Level    byte               `json:"level"`
}

TrojanServerTarget is configuration of a single trojan server

type TrojanUserConfig

type TrojanUserConfig struct {
	Password string `json:"password"`
	Level    byte   `json:"level"`
	Email    string `json:"email"`
}

TrojanUserConfig is user configuration

type UTPAuthenticator

type UTPAuthenticator struct{}

func (UTPAuthenticator) Build

func (UTPAuthenticator) Build() (proto.Message, error)

type VLessInboundConfig

type VLessInboundConfig struct {
	Clients    []json.RawMessage       `json:"clients"`
	Decryption string                  `json:"decryption"`
	Fallback   json.RawMessage         `json:"fallback"`
	Fallbacks  []*VLessInboundFallback `json:"fallbacks"`
}

func (*VLessInboundConfig) Build

func (c *VLessInboundConfig) Build() (proto.Message, error)

Build implements Buildable

type VLessInboundFallback

type VLessInboundFallback struct {
	Alpn string          `json:"alpn"`
	Path string          `json:"path"`
	Type string          `json:"type"`
	Dest json.RawMessage `json:"dest"`
	Xver uint64          `json:"xver"`
}

type VLessOutboundConfig

type VLessOutboundConfig struct {
	Vnext []*VLessOutboundVnext `json:"vnext"`
}

func (*VLessOutboundConfig) Build

func (c *VLessOutboundConfig) Build() (proto.Message, error)

Build implements Buildable

type VLessOutboundVnext

type VLessOutboundVnext struct {
	Address *cfgcommon.Address `json:"address"`
	Port    uint16             `json:"port"`
	Users   []json.RawMessage  `json:"users"`
}

type VMessAccount

type VMessAccount struct {
	ID          string `json:"id"`
	AlterIds    uint16 `json:"alterId"`
	Security    string `json:"security"`
	Experiments string `json:"experiments"`
}

func (*VMessAccount) Build

func (a *VMessAccount) Build() *vmess.Account

Build implements Buildable

type VMessDefaultConfig

type VMessDefaultConfig struct {
	AlterIDs uint16 `json:"alterId"`
	Level    byte   `json:"level"`
}

func (*VMessDefaultConfig) Build

Build implements Buildable

type VMessDetourConfig

type VMessDetourConfig struct {
	ToTag string `json:"to"`
}

func (*VMessDetourConfig) Build

Build implements Buildable

type VMessInboundConfig

type VMessInboundConfig struct {
	Users        []json.RawMessage   `json:"clients"`
	Features     *FeaturesConfig     `json:"features"`
	Defaults     *VMessDefaultConfig `json:"default"`
	DetourConfig *VMessDetourConfig  `json:"detour"`
	SecureOnly   bool                `json:"disableInsecureEncryption"`
}

func (*VMessInboundConfig) Build

func (c *VMessInboundConfig) Build() (proto.Message, error)

Build implements Buildable

type VMessOutboundConfig

type VMessOutboundConfig struct {
	Receivers []*VMessOutboundTarget `json:"vnext"`
}

func (*VMessOutboundConfig) Build

func (c *VMessOutboundConfig) Build() (proto.Message, error)

Build implements Buildable

type VMessOutboundTarget

type VMessOutboundTarget struct {
	Address *cfgcommon.Address `json:"address"`
	Port    uint16             `json:"port"`
	Users   []json.RawMessage  `json:"users"`
}

type WebSocketConfig

type WebSocketConfig struct {
	Path                 string            `json:"path"`
	Headers              map[string]string `json:"headers"`
	AcceptProxyProtocol  bool              `json:"acceptProxyProtocol"`
	MaxEarlyData         int32             `json:"maxEarlyData"`
	UseBrowserForwarding bool              `json:"useBrowserForwarding"`
	EarlyDataHeaderName  string            `json:"earlyDataHeaderName"`
}

func (*WebSocketConfig) Build

func (c *WebSocketConfig) Build() (proto.Message, error)

Build implements Buildable.

type WechatVideoAuthenticator

type WechatVideoAuthenticator struct{}

func (WechatVideoAuthenticator) Build

type WireguardAuthenticator

type WireguardAuthenticator struct{}

func (WireguardAuthenticator) Build

Jump to

Keyboard shortcuts

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