Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDomainTree ¶
func NewDomainTree(conf *Conf) (*suffixtree.DomainTree, error)
NewDomainTree is ... generate domain tree from configuration
Types ¶
type App ¶
type App struct {
// Logger is ...
// to print logs
Logger logger.Logger
// Conf is ...
// shadow configuration
Conf *Conf
// Timeout is ...
// timeout for closing UDP connections
Timeout time.Duration
// contains filtered or unexported fields
}
App is shadow application
func NewAppFromByteSlice ¶
NewAppFromByteSlice is new shadow app from byte slice
func NewAppFromConf ¶
NewAppFromConf is new shadow app from *Conf
type Conf ¶
type Conf struct {
// Server is ...
// proxy server address
// {
// "protocol": "",
// "url": "",
// "server": ""
// }
// ss://chacha20-ietf-poly1305:[email protected]:8388
Server json.RawMessage `json:"server"`
// NameServer is ...
// dns resolver server address
// tls://1.1.1.1:853
// https://1.1.1.1:443/dns-query
NameServer []string `json:"name_server"`
// ProxyServer is ...
// for incoming socks5/http proxy
// 127.0.0.1:1080
ProxyServer string `json:"proxy_server,omitempty"`
// FilterString is ...
// WinDivert fitler string
// generate if not exist
FilterString string `json:"windivert_filter_string,omitempty"`
// GeoIP is ...
// process packets by geo info of target IP
GeoIP struct {
// File is ...
// mmdb file path
File string `json:"file"`
// Proxy is ...
// ISO code of countries to be proxied
Proxy []string `json:"proxy,omitempty"`
// Bypass is ...
// ISO code of countries to be bypassed
Bypass []string `json:"bypass,omitempty"`
// Final is ...
// default action when country code does not appears in `Proxy` or `Bypass`
Final string `json:"final"`
} `json:"geo_ip_rules,omitempty"`
// AppRules is ...
// proxy selected programs
AppRules struct {
// Proxy is ...
Proxy []string `json:"proxy"`
} `json:"app_rules,omitempty"`
// Tun is ...
// config for tun device
Tun struct {
// TunName is ...
// for macOS, this should be utun[0-9]
TunName string `json:"tun_name,omitempty"`
// TunAddr is ...
// tun device ip address
// 192.168.0.11/24
// fe80:08ef:ae86:68ea::11/64
TunAddr []string `json:"tun_addr,omitempty"`
// NameServer is ...
NameServer string `json:"name_server,omitempty"`
// MTU is ...
// set MTU for tun device
MTU int `json:"mtu,omitempty"`
// PreUp is ...
PreUp string `json:"pre_up,omitempty"`
// PostUp is ...
PostUp string `json:"post_up,omitempty"`
// PreDown is ...
PreDown string `json:"pre_down,omitempty"`
// PostDown is ...
PostDown string `json:"post_down,omitempty"`
} `json:"tun,omitempty"`
// IPCIDRRules is ...
// Tun: try to add these cidrs to route table
// WinDivert: use radix tree to select packets
IPCIDRRules struct {
// Proxy is ...
Proxy []string `json:"proxy"`
} `json:"ip_cidr_rules"`
// DomianRules is ...
// hijack dns queries and process with domain rules
DomainRules struct {
// GeoSite is ...
GeoSite struct {
// File is ...
// path to geosite.dat
File string `json:"file"`
// Proxy is ...
Proxy []string `json:"proxy,omitempty"`
// Bypass is ...
Bypass []string `json:"bypass,omitempty"`
// Final is ...
Final string `json:"final,omitempty"`
} `json:"geo_site,omitempty"`
// DisableHijack is ...
// hijack dns queries
DisableHijack bool `json:"disable_hijack,omitempty"`
// Proxy is ...
// fake ip with prefix of 198.18 will be assigned
Proxy []string `json:"proxy"`
// Direct is ...
// send queries to remote dns server
Direct []string `json:"direct,omitempty"`
// Blocked is ...
// answer 0.0.0.0 or ::0
Blocked []string `json:"blocked,omitempty"`
} `json:"domain_rules"`
}
Conf is shadow application configuration
func (*Conf) ReadFromByteSlice ¶
ReadFromByteSlice is to load config from byte slice
func (*Conf) ReadFromFile ¶
ReadFromFile is to read config from file
Click to show internal directories.
Click to hide internal directories.