config

package
v0.0.0-...-108e96f Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Configurations       = new(LocalConfig)
	LeftQuote      int64 = 1 * 1024 * 1024 // 1MB initially
	AllowedPort          = make(map[int]bool)
	DeniedPort           = make(map[int]bool)
	AllowedIP            = make(map[uint32]bool) // IPv4 only
	DeniedIP             = make(map[uint32]bool) // IPv4 only

	DefaultPort   string
	DefaultKey    string
	DefaultMethod string
)

Functions

func ApplyGeneralConfig

func ApplyGeneralConfig()

func ParseMultiServersConfigFile

func ParseMultiServersConfigFile(path string) error

Types

type ACL

type ACL struct {
	Port AllowDeny `json:"port"`
	IP   AllowDeny `json:"ip"`
}

ACL access control list

type APIConfiguration

type APIConfiguration struct {
	API        string `json:"api"`
	APIEnabled bool   `json:"api_enabled"`
}

type AllowDeny

type AllowDeny struct {
	Allow string `json:"allow"`
	Deny  string `json:"deny"`
}

AllowDeny items for ACL

type ConsoleConfiguration

type ConsoleConfiguration struct {
	ConsoleReportEnabled bool   `json:"console_report_enabled"`
	ConsoleHost          string `json:"console_host"`
	ConsoleVersion       string `json:"console_version"`
	ConsoleWebSocketURL  string `json:"console_websocket_url"`
}

type DNS

type DNS struct {
	DNSCacheConfiguration
	DNSTimeoutConfiguration
	DNSAbroadServerConfiguration
	DNSChinaServerConfiguration
	DNSEdnsClientSubnetConfiguration
	Enabled      bool              `json:"enabled"`
	SearchDomain string            `json:"search_domain"`
	Local        []*DNSConfig      `json:"local"`
	Server       DNSServerSpecific `json:"server"`
}

DNS represents the DNS section in configuration file

func (*DNS) UnmarshalJSON

func (g *DNS) UnmarshalJSON(b []byte) error

UnmarshalJSON override the json unmarshal method, so that some fields could be initialized correctly

type DNSAbroadServerConfiguration

type DNSAbroadServerConfiguration struct {
	AbroadServerCount string       `json:"abroad_server_count"`
	AbroadProtocol    string       `json:"abroad_protocol"`
	Abroad            []*DNSConfig `json:"abroad"`
}

type DNSCacheConfiguration

type DNSCacheConfiguration struct {
	CacheEnabled bool `json:"cache"`
	CacheTTL     bool `json:"cache_ttl"`
	CacheTimeout time.Duration
}

type DNSChinaServerConfiguration

type DNSChinaServerConfiguration struct {
	ChinaServerCount string       `json:"china_server_count"`
	China            []*DNSConfig `json:"china"`
}

type DNSConfig

type DNSConfig struct {
	Address                 string `json:"address"`
	Protocol                string `json:"protocol"`
	EDNSClientSubnetEnabled bool   `json:"edns_client_subnet_enabled"`
}

DNSConfig represents each DNS server configuration

type DNSEdnsClientSubnetConfiguration

type DNSEdnsClientSubnetConfiguration struct {
	EDNSClientSubnetPolicy string `json:"edns_client_subnet_policy"`
	EDNSClientSubnetIP     string `json:"edns_client_subnet_ip"`
}

type DNSServerSpecific

type DNSServerSpecific struct {
	Domains []string     `json:"domains"`
	Servers []*DNSConfig `json:"servers"`
}

DNSServerSpecific some domain names should be resolved by some special DNS servers

type DNSTimeoutConfiguration

type DNSTimeoutConfiguration struct {
	Timeout      time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

type DebuggingConfiguration

type DebuggingConfiguration struct {
	LogLevel     int  `json:"log_level"`
	PProfEnabled bool `json:"pprof"`
	GenRelease   bool `json:"gen_release"`
}

type GeneralConfig

type GeneralConfig struct {
	SSRSubscription         string `json:"ssrsub"`
	SSRSubscriptionEnabled  bool   `json:"ssrsub_enabled"`
	Token                   string `json:"token"`
	CacheService            string `json:"cache_service"`
	ProtectSocketPathPrefix string `json:"protect_socket_path_prefix"`
	MaxOpenFiles            uint64 `json:"max_openfiles"`
	BroadcastEnabled        bool   `json:"broadcast_enabled"`
	Timeout                 time.Duration
	InboundTimeout          time.Duration
	ProxyPolicyConfiguration
	DebuggingConfiguration
	APIConfiguration
	PriorityInterfaceConfiguration
	ConsoleConfiguration
}

GeneralConfig represents the general config section in configuration file

func (*GeneralConfig) UnmarshalJSON

func (g *GeneralConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON override the json unmarshal method, so that some fields could be initialized correctly

type LocalConfig

type LocalConfig struct {
	Generals        *GeneralConfig       `json:"general"`
	DNSProxy        *DNS                 `json:"dns"`
	Target          *ACL                 `json:"target"`
	InboundConfig   *inbound.Inbound     `json:"github.com/LincolnYe/avege/inbound"`
	InboundsConfig  []*inbound.Inbound   `json:"inbounds"`
	OutboundsConfig []*outbound.Outbound `json:"outbounds"`
}

LocalConfig represents the whole configuration file struct

type PriorityInterfaceConfiguration

type PriorityInterfaceConfiguration struct {
	PriorityInterfaceEnabled bool   `json:"priority_interface_enabled"`
	PriorityInterfaceAddress string `json:"priority_interface_address"`
}

type ProxyPolicyConfiguration

type ProxyPolicyConfiguration struct {
	LoadBalance      string `json:"load_balance"`
	UDPEnabled       bool   `json:"udp_enabled"`
	Tun2SocksEnabled bool   `json:"tun2socks_enabled"`
}

Jump to

Keyboard shortcuts

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