Documentation ¶
Index ¶
- Constants
- Variables
- func AuthRequired(c *gin.Context)
- func IsExistPatternScheme(scheme string) bool
- type ConnData
- type Dns
- type DnsClient
- type DnsClients
- 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
- func (p *DomainKeywordPattern) Add(val string)
- func (p *DomainKeywordPattern) MarshalJSON() ([]byte, error)
- func (p *DomainKeywordPattern) Match(val interface{}) bool
- func (p *DomainKeywordPattern) Name() string
- func (p *DomainKeywordPattern) Policy() string
- func (p *DomainKeywordPattern) Proxy() string
- func (p *DomainKeywordPattern) Remove(val string)
- func (p *DomainKeywordPattern) Scheme() string
- type DomainPattern
- func (p *DomainPattern) Add(val string)
- func (p *DomainPattern) MarshalJSON() ([]byte, error)
- func (p *DomainPattern) Match(val interface{}) bool
- func (p *DomainPattern) Name() string
- func (p *DomainPattern) Policy() string
- func (p *DomainPattern) Proxy() string
- func (p *DomainPattern) Remove(val string)
- func (p *DomainPattern) Scheme() string
- type DomainRecord
- type DomainSuffixPattern
- func (p *DomainSuffixPattern) Add(val string)
- func (p *DomainSuffixPattern) MarshalJSON() ([]byte, error)
- func (p *DomainSuffixPattern) Match(val interface{}) bool
- func (p *DomainSuffixPattern) Name() string
- func (p *DomainSuffixPattern) Policy() string
- func (p *DomainSuffixPattern) Proxy() string
- func (p *DomainSuffixPattern) Remove(val string)
- func (p *DomainSuffixPattern) Scheme() string
- type GeneralConfig
- type IPCIDRPattern
- func (p *IPCIDRPattern) Add(val string)
- func (p *IPCIDRPattern) MarshalJSON() ([]byte, error)
- func (p *IPCIDRPattern) Match(val interface{}) bool
- func (p *IPCIDRPattern) Name() string
- func (p *IPCIDRPattern) Policy() string
- func (p *IPCIDRPattern) Proxy() string
- func (p *IPCIDRPattern) Remove(val string)
- func (p *IPCIDRPattern) Scheme() string
- type IPCountryPattern
- func (p *IPCountryPattern) Add(val string)
- func (p *IPCountryPattern) MarshalJSON() ([]byte, error)
- func (p *IPCountryPattern) Match(val interface{}) bool
- func (p *IPCountryPattern) Name() string
- func (p *IPCountryPattern) Policy() string
- func (p *IPCountryPattern) Proxy() string
- func (p *IPCountryPattern) Remove(val string)
- func (p *IPCountryPattern) Scheme() string
- type IPRange
- type IPRangeArray
- type KoneConfig
- type Manager
- type ManagerConfig
- type NameServer
- 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 AuthRequired ¶
AuthRequired is a simple middleware to check the session
func IsExistPatternScheme ¶
Types ¶
type DnsClients ¶
func GetDnsClients ¶
func GetDnsClients(cfg DnsConfig) DnsClients
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) Add ¶
func (p *DomainKeywordPattern) Add(val string)
func (*DomainKeywordPattern) MarshalJSON ¶
func (p *DomainKeywordPattern) MarshalJSON() ([]byte, error)
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
func (*DomainKeywordPattern) Remove ¶
func (p *DomainKeywordPattern) Remove(val string)
func (*DomainKeywordPattern) Scheme ¶
func (p *DomainKeywordPattern) Scheme() string
type DomainPattern ¶
type DomainPattern struct {
// contains filtered or unexported fields
}
DOMAIN
func (*DomainPattern) Add ¶
func (p *DomainPattern) Add(val string)
func (*DomainPattern) MarshalJSON ¶
func (p *DomainPattern) MarshalJSON() ([]byte, error)
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
func (*DomainPattern) Remove ¶
func (p *DomainPattern) Remove(val string)
func (*DomainPattern) Scheme ¶
func (p *DomainPattern) Scheme() 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) Add ¶
func (p *DomainSuffixPattern) Add(val string)
func (*DomainSuffixPattern) MarshalJSON ¶
func (p *DomainSuffixPattern) MarshalJSON() ([]byte, error)
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
func (*DomainSuffixPattern) Remove ¶
func (p *DomainSuffixPattern) Remove(val string)
func (*DomainSuffixPattern) Scheme ¶
func (p *DomainSuffixPattern) Scheme() string
type GeneralConfig ¶
type GeneralConfig struct {
Network string // tun network
}
type IPCIDRPattern ¶
type IPCIDRPattern struct {
// contains filtered or unexported fields
}
IP-CIDR
func (*IPCIDRPattern) Add ¶
func (p *IPCIDRPattern) Add(val string)
func (*IPCIDRPattern) MarshalJSON ¶
func (p *IPCIDRPattern) MarshalJSON() ([]byte, error)
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
func (*IPCIDRPattern) Remove ¶
func (p *IPCIDRPattern) Remove(val string)
func (*IPCIDRPattern) Scheme ¶
func (p *IPCIDRPattern) Scheme() string
type IPCountryPattern ¶
type IPCountryPattern struct {
// contains filtered or unexported fields
}
IP-COUNTRY
func (*IPCountryPattern) Add ¶
func (p *IPCountryPattern) Add(val string)
func (*IPCountryPattern) MarshalJSON ¶
func (p *IPCountryPattern) MarshalJSON() ([]byte, error)
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
func (*IPCountryPattern) Remove ¶
func (p *IPCountryPattern) Remove(val string)
func (*IPCountryPattern) Scheme ¶
func (p *IPCountryPattern) Scheme() 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 NameServer ¶
func (*NameServer) String ¶
func (ns *NameServer) String() 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 ¶
type Pattern interface { Name() string Scheme() string Policy() string Proxy() string Add(string) Remove(string) Match(val interface{}) bool MarshalJSON() ([]byte, error) }
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.