blackwhite

package
v0.0.0-...-d329b08 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type BlackWhite

type BlackWhite struct {
	Mode         string // mode is white or black
	Domains      map[string]byte
	Nets         []*net.IPNet
	Timeout      int
	Deadline     int
	Socks5Handle socks5.Handler
	BlackDNS     string
	WhiteDNS     string
}

BlackWhite is a middleman.

func NewBlackWhite

func NewBlackWhite(mode, domainURL, cidrURL, blackDNS, whiteDNS string, timeout, deadline int) (*BlackWhite, error)

NewBlackWhite returns a BlackWhite.

func (*BlackWhite) DNSHandle

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

DNSHandle handles DNS query.

func (*BlackWhite) Handle

func (b *BlackWhite) 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 (*BlackWhite) Has

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

Has domain or IP.

func (*BlackWhite) TCPHandle

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

TCPHandle handles tcp request.

func (*BlackWhite) UDPHandle

func (b *BlackWhite) 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