rule

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListDir

func ListDir(dirPth string, suffix string) (files []string, err error)

ListDir returns file list named with suffix in dirPth

Types

type Config

type Config struct {
	Forward        []string
	StrategyConfig strategy.Config

	DNSServers []string
	IPSet      string

	Domain []string
	IP     []string
	CIDR   []string
	// contains filtered or unexported fields
}

Config , every rule dialer points to a rule file

func NewConfFromFile

func NewConfFromFile(ruleFile string) (*Config, error)

NewConfFromFile .

type Dialer

type Dialer struct {
	// contains filtered or unexported fields
}

Dialer struct

func NewDialer

func NewDialer(rules []*Config, gDialer proxy.Dialer) *Dialer

NewDialer returns a new rule dialer

func (*Dialer) AddDomainIP

func (rd *Dialer) AddDomainIP(domain, ip string) error

AddDomainIP used to update ipMap rules according to domainMap rule

func (*Dialer) Addr

func (rd *Dialer) Addr() string

Addr returns RuleDialer's address, always be "RULES"

func (*Dialer) Check

func (rd *Dialer) Check()

Check .

func (*Dialer) Dial

func (rd *Dialer) Dial(network, addr string) (net.Conn, error)

Dial dials to targer addr and return a conn

func (*Dialer) DialUDP

func (rd *Dialer) DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error)

DialUDP connects to the given address via the proxy

func (*Dialer) NextDialer

func (rd *Dialer) NextDialer(dstAddr string) proxy.Dialer

NextDialer return next dialer according to rule

Jump to

Keyboard shortcuts

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