route

package
v0.0.0-...-a7e2b7f Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RE_DHCP, _ = regexp.Compile(`DHCP`)
View Source
var RE_IIp, _ = regexp.Compile(`\d+\.\d+\.\d+\.\d+`)
View Source
var RE_IName, _ = regexp.Compile(`".+?"`)

Functions

func Exist

func Exist(filename string) bool

func ResetDns

func ResetDns() error

func SetDns

func SetDns(tunName string, dnsIps []net.IP) error

Types

type IDns

type IDns struct {
	Name string
	Ips  []net.IP
	Dhcp bool
}

type Route

type Route struct {
	Network net.IP
	Mask    byte
}

func (*Route) GetIpv4Mask

func (r *Route) GetIpv4Mask() net.IP

type RouteTable

type RouteTable interface {
	// 增加 Net 路由表
	// Net 路由表指的是走非 VPN 的路由表
	// 即 VPN 白名单。
	// 内部根据默认路由确定 WAN 网关地址。
	AddNetRoutes(routes []Route) error

	// 增加 VPN 路由表
	// 走 VPN 网络的路由表
	// 内部会将 0.0.0.0/0 拆分为两个,防止干扰造成找不到默认路由表的问题
	// 内部根据提供的本地接口确定
	AddVpnRoutes(routes []Route, network, mask, gIp net.IP) error

	// 清洗功能
	// 清洗路由表,删除所有非本地接口、非默认网关的路由条目、跃点数为X的路由条目...
	// 感觉这个实现并不好。
	ResetRoute() error
}

func NewRouteTable

func NewRouteTable() RouteTable

Jump to

Keyboard shortcuts

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