wireguard

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 34 Imported by: 2

README

wireguard

A wrapper for Wireguard to make simple user mode peers.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Net

type Net netTun

func CreateNetTUN

func CreateNetTUN(localAddresses, dnsServers []netip.Addr, mtu int, handleLocal bool) (tun.Device, *Net, error)

func (*Net) Dial

func (tnet *Net) Dial(network, address string) (net.Conn, error)

func (*Net) DialContext

func (tnet *Net) DialContext(ctx context.Context, network, address string) (net.Conn, error)

func (*Net) DialContextTCP

func (net *Net) DialContextTCP(ctx context.Context, addr *net.TCPAddr) (*gonet.TCPConn, error)

func (*Net) DialContextTCPAddrPort

func (net *Net) DialContextTCPAddrPort(ctx context.Context, addr netip.AddrPort) (*gonet.TCPConn, error)

func (*Net) DialPing

func (net *Net) DialPing(laddr, raddr *PingAddr) (*PingConn, error)

func (*Net) DialPingAddr

func (net *Net) DialPingAddr(laddr, raddr netip.Addr) (*PingConn, error)

func (*Net) DialTCP

func (net *Net) DialTCP(addr *net.TCPAddr) (*gonet.TCPConn, error)

func (*Net) DialTCPAddrPort

func (net *Net) DialTCPAddrPort(addr netip.AddrPort) (*gonet.TCPConn, error)

func (*Net) DialUDP

func (net *Net) DialUDP(laddr, raddr *net.UDPAddr) (*gonet.UDPConn, error)

func (*Net) DialUDPAddrPort

func (net *Net) DialUDPAddrPort(laddr, raddr netip.AddrPort) (*gonet.UDPConn, error)

func (*Net) ListenPing

func (net *Net) ListenPing(laddr *PingAddr) (*PingConn, error)

func (*Net) ListenPingAddr

func (net *Net) ListenPingAddr(laddr netip.Addr) (*PingConn, error)

func (*Net) ListenTCP

func (net *Net) ListenTCP(addr *net.TCPAddr) (*gonet.TCPListener, error)

func (*Net) ListenTCPAddrPort

func (net *Net) ListenTCPAddrPort(addr netip.AddrPort) (*gonet.TCPListener, error)

func (*Net) ListenUDP

func (net *Net) ListenUDP(laddr *net.UDPAddr) (*gonet.UDPConn, error)

func (*Net) ListenUDPAddrPort

func (net *Net) ListenUDPAddrPort(laddr netip.AddrPort) (*gonet.UDPConn, error)

func (*Net) LookupContextHost

func (tnet *Net) LookupContextHost(ctx context.Context, host string) ([]string, error)

func (*Net) LookupHost

func (net *Net) LookupHost(host string) (addrs []string, err error)

func (*Net) Stack

func (net *Net) Stack() *stack.Stack

type NetHandler added in v0.1.0

type NetHandler interface {
	HandleConn(network string, ip net.IP, port uint16, conn net.Conn)
}

type PingAddr

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

func PingAddrFromAddr

func PingAddrFromAddr(addr netip.Addr) *PingAddr

func (PingAddr) Addr

func (ia PingAddr) Addr() netip.Addr

func (PingAddr) Network

func (ia PingAddr) Network() string

func (PingAddr) String

func (ia PingAddr) String() string

type PingConn

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

func (*PingConn) Close

func (pc *PingConn) Close() error

func (*PingConn) LocalAddr

func (pc *PingConn) LocalAddr() net.Addr

func (*PingConn) Read

func (pc *PingConn) Read(p []byte) (n int, err error)

func (*PingConn) ReadFrom

func (pc *PingConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*PingConn) RemoteAddr

func (pc *PingConn) RemoteAddr() net.Addr

func (*PingConn) SetDeadline

func (pc *PingConn) SetDeadline(t time.Time) error

func (*PingConn) SetReadDeadline

func (pc *PingConn) SetReadDeadline(t time.Time) error

func (*PingConn) SetWriteDeadline

func (pc *PingConn) SetWriteDeadline(t time.Time) error

func (*PingConn) Write

func (pc *PingConn) Write(p []byte) (n int, err error)

func (*PingConn) WriteTo

func (pc *PingConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

type SimpleFlowHandler added in v0.1.0

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

func NewSimpleFlowHandler added in v0.1.0

func NewSimpleFlowHandler() *SimpleFlowHandler

func (*SimpleFlowHandler) HandleConn added in v0.1.0

func (s *SimpleFlowHandler) HandleConn(network string, ip net.IP, port uint16, conn net.Conn)

HandleConn implements NetHandler.

func (*SimpleFlowHandler) ListenTCPAddr added in v0.1.0

func (s *SimpleFlowHandler) ListenTCPAddr(listen string) (net.Listener, error)

func (*SimpleFlowHandler) RemoveTCPListener added in v0.1.0

func (s *SimpleFlowHandler) RemoveTCPListener(listen string) error

type Wireguard

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

func NewFromConfig

func NewFromConfig(addr string, mtu int, config string, handler NetHandler) (*Wireguard, error)

func NewServer

func NewServer(addr string, mtu int, handler NetHandler) (*Wireguard, error)

func (*Wireguard) Close

func (wg *Wireguard) Close() error

func (*Wireguard) CreatePeer

func (wg *Wireguard) CreatePeer(publicIp string) (string, error)

func (*Wireguard) Dial

func (wg *Wireguard) Dial(network string, addr string) (net.Conn, error)

func (*Wireguard) DialContext

func (wg *Wireguard) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)

func (*Wireguard) GetConfig added in v0.0.2

func (wg *Wireguard) GetConfig() (string, error)

func (*Wireguard) Listen

func (wg *Wireguard) Listen(network string, addr string) (net.Listener, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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