countryonly

package
v0.0.0-...-8d6b938 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type CountryOnly

type CountryOnly struct {
	Domains      map[string]byte
	Nets         []*net.IPNet
	Timeout      int
	Deadline     int
	Socks5Handle socks5.Handler
	InboundDNS   string
	CountryDNS   string
}

CountryOnly is a middleman.

func NewCountryOnly

func NewCountryOnly(domainURL, cidrURL, inboundDNS, countryDNS string, timeout, deadline int) (*CountryOnly, error)

NewCountryOnly returns a CountryOnly.

func (*CountryOnly) DNSHandle

func (b *CountryOnly) DNSHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) (bool, error)

DNSHandle handles DNS query.

func (*CountryOnly) Handle

func (b *CountryOnly) Handle(method, addr string, request []byte, conn *net.TCPConn) (handled bool, err error)

Handle handles http proxy request, if the domain is in the white list.

func (*CountryOnly) Has

func (b *CountryOnly) Has(host string) bool

Has domain or IP.

func (*CountryOnly) TCPHandle

func (b *CountryOnly) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) (bool, error)

TCPHandle handles tcp request.

func (*CountryOnly) UDPHandle

func (b *CountryOnly) UDPHandle(s *socks5.Server, ca *net.UDPAddr, d *socks5.Datagram) (bool, error)

UDPHandle handles udp packet.

Jump to

Keyboard shortcuts

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