wireguard

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MIT * * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. * Original source: https://github.com/WireGuard/wireguard-windows/blob/004c22c5647e5c492daf21d0310cbf575e4e3277/conf/config.go

SPDX-License-Identifier: MIT * * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. * * Original copy: https://github.com/WireGuard/wireguard-windows/blob/004c22c5647e5c492daf21d0310cbf575e4e3277/conf/parser.go

Index

Constants

View Source
const (
	DefaultMtu = 1420
)
View Source
const KeyLength = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes uint64

type Config

type Config struct {
	Name      string
	Interface Interface
	Peers     []Peer
}

func FromWgQuick

func FromWgQuick(s, name string) (*Config, error)

func FromWgQuickFile

func FromWgQuickFile(file, name string) (*Config, error)

type Endpoint

type Endpoint struct {
	Host string
	Port uint16
}

type HandshakeTime

type HandshakeTime time.Duration

type Interface

type Interface struct {
	PrivateKey Key
	Addresses  []netip.Prefix
	ListenPort uint16
	MTU        uint16
	DNS        []netip.Addr
	DNSSearch  []string
	PreUp      string
	PostUp     string
	PreDown    string
	PostDown   string
	TableOff   bool
}

type Key

type Key [KeyLength]byte

func (*Key) IsZero

func (k *Key) IsZero() bool

func (*Key) ToHex

func (k *Key) ToHex() string

type ParseError

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

func (*ParseError) Error

func (e *ParseError) Error() string

type Peer

type Peer struct {
	PublicKey           Key
	PresharedKey        Key
	AllowedIPs          []netip.Prefix
	Endpoint            Endpoint
	PersistentKeepalive uint16
}

type Tunnel

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

func CreateTunnel

func CreateTunnel(config *Config) (*Tunnel, error)

func CreateTunnelFromFile

func CreateTunnelFromFile(file string) (*Tunnel, error)

func (*Tunnel) Dial

func (t *Tunnel) Dial(network, addr string) (net.Conn, error)

func (*Tunnel) Listen

func (t *Tunnel) Listen(proto string, address string) (net.Listener, error)

Jump to

Keyboard shortcuts

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