Documentation ¶
Index ¶
- Constants
- Variables
- func IsExistPatternScheme(scheme string) bool
- type ConnData
- type Dns
- type DnsConfig
- type DnsIPPool
- type DnsTable
- func (c *DnsTable) Contains(ip net.IP) bool
- func (c *DnsTable) Get(domain string) *DomainRecord
- func (c *DnsTable) GetByIP(ip net.IP) *DomainRecord
- func (c *DnsTable) IsNonProxyDomain(domain string) bool
- func (c *DnsTable) Serve() error
- func (c *DnsTable) Set(domain string, proxy string) *DomainRecord
- func (c *DnsTable) SetNonProxyDomain(domain string, ttl uint32)
- type DomainKeywordPattern
- type DomainPattern
- type DomainRecord
- type DomainSuffixPattern
- type GeneralConfig
- type IPCIDRPattern
- type IPCountryPattern
- type IPRange
- type IPRangeArray
- type KoneConfig
- type Manager
- type ManagerConfig
- type Nat
- type NatConfig
- type NatSession
- type NatTable
- type One
- type PacketFilter
- type PacketFilterFunc
- type Pattern
- func CreatePattern(name string, config *PatternConfig) Pattern
- func NewDomainKeywordPattern(name, policy, proxy string, vals []string) Pattern
- func NewDomainPattern(name, policy, proxy string, vals []string) Pattern
- func NewDomainSuffixPattern(name, policy, proxy string, vals []string) Pattern
- func NewIPCIDRPattern(name, policy, proxy string, vals []string) Pattern
- func NewIPCountryPattern(name, policy, proxy string, vals []string) Pattern
- type PatternConfig
- type Proxies
- type ProxyConfig
- type RouteConfig
- type Rule
- type RuleConfig
- type TCPRelay
- type TrafficRecord
- type TrafficRecordDetail
- type TunDriver
- type UDPRelay
- type UDPTunnel
Constants ¶
View Source
const ( NatSessionLifeSeconds = 600 NatSessionCheckInterval = 300 )
View Source
const ( PROXY_POLICY = "PROXY" DIRECT_POLICY = "DIRECT" REJECT_POLICY = "REJECT" )
View Source
const DnsIPPoolMaxSpace = 0x3ffff // 4*65535
Variables ¶
View Source
var MTU = 1500
Functions ¶
func IsExistPatternScheme ¶
Types ¶
type DnsIPPool ¶
type DnsIPPool struct {
// contains filtered or unexported fields
}
type DnsTable ¶
type DnsTable struct {
// contains filtered or unexported fields
}
func (*DnsTable) Get ¶
func (c *DnsTable) Get(domain string) *DomainRecord
func (*DnsTable) IsNonProxyDomain ¶
func (*DnsTable) SetNonProxyDomain ¶
type DomainKeywordPattern ¶
type DomainKeywordPattern struct {
// contains filtered or unexported fields
}
DOMAIN-KEYWORD
func (*DomainKeywordPattern) Match ¶
func (p *DomainKeywordPattern) Match(val interface{}) bool
func (*DomainKeywordPattern) Name ¶
func (p *DomainKeywordPattern) Name() string
func (*DomainKeywordPattern) Policy ¶
func (p *DomainKeywordPattern) Policy() string
func (*DomainKeywordPattern) Proxy ¶
func (p *DomainKeywordPattern) Proxy() string
type DomainPattern ¶
type DomainPattern struct {
// contains filtered or unexported fields
}
DOMAIN
func (*DomainPattern) Match ¶
func (p *DomainPattern) Match(val interface{}) bool
func (*DomainPattern) Name ¶
func (p *DomainPattern) Name() string
func (*DomainPattern) Policy ¶
func (p *DomainPattern) Policy() string
func (*DomainPattern) Proxy ¶
func (p *DomainPattern) Proxy() string
type DomainRecord ¶
type DomainRecord struct { Hostname string // hostname Proxy string // proxy IP net.IP // nat ip RealIP net.IP // real ip Hits int Expires time.Time // contains filtered or unexported fields }
hijacked domain
func (*DomainRecord) SetRealIP ¶
func (record *DomainRecord) SetRealIP(msg *dns.Msg)
func (*DomainRecord) Touch ¶
func (record *DomainRecord) Touch()
type DomainSuffixPattern ¶
type DomainSuffixPattern struct {
// contains filtered or unexported fields
}
DOMAIN-SUFFIX
func (*DomainSuffixPattern) AddDomain ¶
func (p *DomainSuffixPattern) AddDomain(val string)
func (*DomainSuffixPattern) Match ¶
func (p *DomainSuffixPattern) Match(val interface{}) bool
func (*DomainSuffixPattern) Name ¶
func (p *DomainSuffixPattern) Name() string
func (*DomainSuffixPattern) Policy ¶
func (p *DomainSuffixPattern) Policy() string
func (*DomainSuffixPattern) Proxy ¶
func (p *DomainSuffixPattern) Proxy() string
type GeneralConfig ¶
type GeneralConfig struct {
Network string // tun network
}
type IPCIDRPattern ¶
type IPCIDRPattern struct {
// contains filtered or unexported fields
}
IP-CIDR
func (*IPCIDRPattern) Match ¶
func (p *IPCIDRPattern) Match(val interface{}) bool
func (*IPCIDRPattern) Name ¶
func (p *IPCIDRPattern) Name() string
func (*IPCIDRPattern) Policy ¶
func (p *IPCIDRPattern) Policy() string
func (*IPCIDRPattern) Proxy ¶
func (p *IPCIDRPattern) Proxy() string
type IPCountryPattern ¶
type IPCountryPattern struct {
// contains filtered or unexported fields
}
IP-COUNTRY
func (*IPCountryPattern) Match ¶
func (p *IPCountryPattern) Match(val interface{}) bool
func (*IPCountryPattern) Name ¶
func (p *IPCountryPattern) Name() string
func (*IPCountryPattern) Policy ¶
func (p *IPCountryPattern) Policy() string
func (*IPCountryPattern) Proxy ¶
func (p *IPCountryPattern) Proxy() string
type IPRangeArray ¶
type IPRangeArray []IPRange
func (IPRangeArray) Contains ¶
func (a IPRangeArray) Contains(ip uint32) bool
func (IPRangeArray) ContainsIP ¶
func (a IPRangeArray) ContainsIP(ip net.IP) bool
func (IPRangeArray) Len ¶
func (a IPRangeArray) Len() int
func (IPRangeArray) Less ¶
func (a IPRangeArray) Less(i, j int) bool
func (IPRangeArray) Swap ¶
func (a IPRangeArray) Swap(i, j int)
type KoneConfig ¶
type KoneConfig struct { General GeneralConfig TCP NatConfig UDP NatConfig Dns DnsConfig Route RouteConfig Proxy map[string]*ProxyConfig Pattern map[string]*PatternConfig Rule RuleConfig Manager ManagerConfig }
func ParseConfig ¶
func ParseConfig(filename string) (*KoneConfig, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(one *One, cfg ManagerConfig) *Manager
type ManagerConfig ¶
type ManagerConfig struct {
Listen string
}
type NatSession ¶
type NatSession struct {
// contains filtered or unexported fields
}
type NatTable ¶
type NatTable struct {
// contains filtered or unexported fields
}
type One ¶
type One struct {
// contains filtered or unexported fields
}
func FromConfig ¶
func FromConfig(cfg *KoneConfig) (*One, error)
type PacketFilter ¶
type PacketFilter interface {
Filter(wr io.Writer, p tcpip.IPv4Packet)
}
type PacketFilterFunc ¶
type PacketFilterFunc func(wr io.Writer, p tcpip.IPv4Packet)
func (PacketFilterFunc) Filter ¶
func (f PacketFilterFunc) Filter(wr io.Writer, p tcpip.IPv4Packet)
type Pattern ¶
func CreatePattern ¶
func CreatePattern(name string, config *PatternConfig) Pattern
func NewDomainKeywordPattern ¶
func NewDomainPattern ¶
func NewDomainSuffixPattern ¶
func NewIPCIDRPattern ¶
func NewIPCountryPattern ¶
type PatternConfig ¶
https://manual.nssurge.com/policy.html There are 3 types of policies: PROXY, DIRECT and REJECT
type Proxies ¶
type Proxies struct {
// contains filtered or unexported fields
}
func NewProxies ¶
func NewProxies(one *One, config map[string]*ProxyConfig) (*Proxies, error)
type ProxyConfig ¶
type RouteConfig ¶
type RouteConfig struct {
V []string
}
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
func NewRule ¶
func NewRule(config RuleConfig, patterns map[string]*PatternConfig) *Rule
func (*Rule) DirectDomain ¶
type RuleConfig ¶
There are 5 types of rules: DOMAIN, DOMAIN-SUFFIX, DOMAIN-KEYWORD, IP-COUNTRY and IP-CIDR
type TCPRelay ¶
type TCPRelay struct {
// contains filtered or unexported fields
}
func NewTCPRelay ¶
type TrafficRecord ¶
type TrafficRecordDetail ¶
statistical data of every host/website/proxy
type TunDriver ¶
type TunDriver struct {
// contains filtered or unexported fields
}
func NewTunDriver ¶
func NewTunDriver(ip net.IP, subnet *net.IPNet, filters map[tcpip.IPProtocol]PacketFilter) (*TunDriver, error)
type UDPRelay ¶
type UDPRelay struct {
// contains filtered or unexported fields
}
func NewUDPRelay ¶
Click to show internal directories.
Click to hide internal directories.