Documentation
¶
Overview ¶
Package wgtypes provides shared types for the wgctrl family of packages.
Index ¶
Constants ¶
const KeyLen = 32 // wgh.KeyLen
KeyLen is the expected key length for a WireGuard key.
const KeyPairLen = KeyLen * 2
KeyPairLen is the expected key buffer size for a private and public WireGuard key.
Variables ¶
var ErrUpdateOnlyNotSupported = errors.New("the UpdateOnly flag is not supported by this platform")
ErrUpdateOnlyNotSupported is returned due to missing kernel support of the PeerConfig UpdateOnly flag.
Functions ¶
func FillKeyPair ¶
FillKeyPair generates a Key suitable for use as a private key from a cryptographically safe source.
Types ¶
type Key ¶
type Key []byte
A Key is a public, private, or pre-shared secret key. The Key constructor functions in this package can be used to create Keys suitable for each of these applications.
type KeyPair ¶
type KeyPair []byte
func GenerateKeyPair ¶
GenerateKeyPair generates a Key suitable for use as a private key from a cryptographically safe source.
func NewKeyPair ¶
NewKeyPair creates a Key from an existing byte slice. The byte slice must be exactly 32 bytes in length.
func ParseKeyPair ¶
ParseKeyPair parses a Key from a base64-encoded string, as produced by the Key.String method.
func (KeyPair) PrivateKey ¶
PrivateKey returns the private key portion of the key pair.