Documentation ¶
Index ¶
- Constants
- Variables
- type ConnData
- type CoreConfig
- type Dns
- type DnsIPPool
- type DnsTable
- func (c *DnsTable) ClearNonProxyDomain()
- 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) IsLocalIP(ip net.IP) bool
- 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 FinalPattern
- type GEOIPPattern
- type GeneralConfig
- type IPCIDRPattern
- type KoneConfig
- type Manager
- type Nat
- type NatSession
- type NatTable
- type One
- type PacketFilter
- type PacketFilterFunc
- type Pattern
- func CreatePattern(rc RuleConfig) Pattern
- func NewDomainKeywordPattern(proxy string, key string) Pattern
- func NewDomainPattern(proxy, domain string) Pattern
- func NewDomainSuffixPattern(proxy, suffix string) Pattern
- func NewGEOIPPattern(proxy string, country string) Pattern
- func NewIPCIDRPattern(proxy string, ipNet *net.IPNet) Pattern
- type Proxies
- type Rule
- type RuleConfig
- type TCPRelay
- type TrafficRecord
- type TrafficRecordDetail
- type TunDriver
- type UDPRelay
- type UDPTunnel
Constants ¶
View Source
const ( HTTP_PROXY = "http_proxy" HTTPS_PROXY = "https_proxy" SOCKS_PROXY = "socks_proxy" )
View Source
const ( DnsDefaultPort = 53 DnsDefaultTtl = 600 DnsDefaultPacketSize = 4096 DnsDefaultReadTimeout = 5 DnsDefaultWriteTimeout = 5 )
View Source
const ( NatSessionLifeSeconds = 600 NatSessionCheckInterval = 300 )
View Source
const DnsIPPoolMaxSpace = 0x3ffff // 4*65535
Variables ¶
View Source
var ErrResolve = errors.New("resolve timeout")
View Source
var MTU = 1500
Functions ¶
This section is empty.
Types ¶
type CoreConfig ¶
type CoreConfig struct { Tun string `ini:"tun"` // tun name Network string `ini:"network"` // tun network TcpListenPort uint16 `ini:"tcp-listen-port"` TcpNatPortStart uint16 `ini:"tcp-nat-port-start"` TcpNatPortEnd uint16 `ini:"tcp-nat-port-end"` UdpListenPort uint16 `ini:"udp-listen-port"` UdpNatPortStart uint16 `ini:"udp-nat-port-start"` UdpNatPortEnd uint16 `ini:"udp-nat-port-end"` DnsListenPort uint16 `ini:"dns-listen-port"` DnsTtl uint `ini:"dns-ttl"` DnsPacketSize uint16 `ini:"dns-packet-size"` DnsReadTimeout uint `ini:"dns-read-timeout"` DnsWriteTimeout uint `ini:"dns-write-timeout"` DnsServer []string `ini:"dns-server" delim:","` }
type DnsIPPool ¶
type DnsIPPool struct {
// contains filtered or unexported fields
}
type DnsTable ¶
type DnsTable struct {
// contains filtered or unexported fields
}
func (*DnsTable) ClearNonProxyDomain ¶
func (c *DnsTable) ClearNonProxyDomain()
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) 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) 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) Match ¶
func (p DomainSuffixPattern) Match(val interface{}) bool
func (DomainSuffixPattern) Proxy ¶
func (p DomainSuffixPattern) Proxy() string
type FinalPattern ¶
type FinalPattern struct {
// contains filtered or unexported fields
}
FINAL
func NewFinalPattern ¶
func NewFinalPattern(proxy string) FinalPattern
func (FinalPattern) Match ¶
func (p FinalPattern) Match(val interface{}) bool
func (FinalPattern) Proxy ¶
func (p FinalPattern) Proxy() string
type GEOIPPattern ¶
type GEOIPPattern struct {
// contains filtered or unexported fields
}
GEOIP
func (GEOIPPattern) Match ¶
func (p GEOIPPattern) Match(val interface{}) bool
func (GEOIPPattern) Proxy ¶
func (p GEOIPPattern) Proxy() string
type GeneralConfig ¶
type IPCIDRPattern ¶
type IPCIDRPattern struct {
// contains filtered or unexported fields
}
IP-CIDR
func (IPCIDRPattern) Match ¶
func (p IPCIDRPattern) Match(val interface{}) bool
func (IPCIDRPattern) Proxy ¶
func (p IPCIDRPattern) Proxy() string
type KoneConfig ¶
type KoneConfig struct { General GeneralConfig Core CoreConfig Proxy map[string]string Rule []RuleConfig // contains filtered or unexported fields }
func ParseConfig ¶
func ParseConfig(source interface{}) (*KoneConfig, error)
func (*KoneConfig) GetSystemDnsservers ¶
func (cfg *KoneConfig) GetSystemDnsservers() (servers []string)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(one *One, cfg *KoneConfig) *Manager
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)
func (*One) Reload ¶
func (one *One) Reload(cfg *KoneConfig) 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(rc RuleConfig) Pattern
func NewDomainKeywordPattern ¶
func NewDomainPattern ¶
func NewDomainSuffixPattern ¶
func NewGEOIPPattern ¶
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
func NewRule ¶
func NewRule(rcs []RuleConfig) *Rule
func (*Rule) DirectDomain ¶
type RuleConfig ¶
type TCPRelay ¶
type TCPRelay struct {
// contains filtered or unexported fields
}
func NewTCPRelay ¶
func NewTCPRelay(one *One, cfg CoreConfig) *TCPRelay
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)
func (*TunDriver) AddRouteString ¶
type UDPRelay ¶
type UDPRelay struct {
// contains filtered or unexported fields
}
func NewUDPRelay ¶
func NewUDPRelay(one *One, cfg CoreConfig) *UDPRelay
Source Files ¶
Click to show internal directories.
Click to hide internal directories.