subnet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoute

func AddRoute(addr, viaAddr net.IP, iName string, debug bool) error

AddRoute routes all traffic for addr via interface iName.

func DelRoute

func DelRoute(addr, viaAddr net.IP, iName string, debug bool) error

DelRoute deletes the route in the system routing table to a specific destination.

func GetNetGateway

func GetNetGateway() (gw, dev string, err error)

GetNetGateway return net gateway (default route) and nic. Credit: https://github.com/bigeagle/gohop/blob/master/hop/iface.go

func SetDefaultGateway

func SetDefaultGateway(gw, iName string, debug bool) error

SetDefaultGateway sets the systems gateway to the IP / device specified.

func SetDevIP

func SetDevIP(iName string, localAddr net.IP, addr *net.IPNet, debug bool) error

SetDevIP sets the local IP address of a network interface.

func SetInterfaceStatus

func SetInterfaceStatus(iName string, up bool, debug bool) error

SetInterfaceStatus brings up or down a network interface.

Types

type Client

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

Client represents a connection to a subnet server.

func NewClient

func NewClient(servAddr, port, network, iName string, newGateway string,
	certPemPath, keyPemPath, caCertPath string, additionalAddresses []net.IP) (*Client, error)

NewClient constructs a Client object.

func (*Client) Close

func (c *Client) Close() error

Close shuts down the client, reversing configuration changes to the system.

func (*Client) Run

func (c *Client) Run()

Run starts the client.

type IPPacket

type IPPacket struct {
	Raw      []byte
	Dest     net.IP
	Protocol waterutil.IPProtocol
}

IPPacket represents a packet in transit over the VPN.

type Reverser

type Reverser struct {
	RouteDeletions []routeEntries
	// contains filtered or unexported fields
}

Reverser contains a sequence of functions that need to be called on exit - to unwind changes made to global configuration.

func (*Reverser) AddRouteEntry

func (r *Reverser) AddRouteEntry(destination net.IP, via net.IP, dev string)

AddRouteEntry adds a route to the deletion set so it is deleted from the routing table when Reverse() is called.

func (*Reverser) Close

func (r *Reverser) Close()

Close applies the changes specified in reverser, such to reverse changes to system configuration.

func (*Reverser) ResetGatewayOSX

func (r *Reverser) ResetGatewayOSX(intf *water.Interface, gw string)

ResetGatewayOSX tells the reverser what gateway should be set on exit.

type Server

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

Server represents a service providing a VPN service to subnet clients.

func NewServer

func NewServer(servHost, port, network, iName string,
	certPemPath, keyPemPath, caCertPath string) (*Server, error)

NewServer returns a new server object representing a VPN service.

func (*Server) Close

func (s *Server) Close() error

Close shuts down the server, reversing configuration changes to the system.

func (*Server) Init

func (s *Server) Init(servHost string) (err error)

Init sets up the server.

func (*Server) Run

func (s *Server) Run()

Run starts the server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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