pnet

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2021 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 7 Imported by: 6

Documentation

Overview

Package pnet provides interfaces for private networking in p2p.

Index

Constants

View Source
const EnvKey = "P2P_FORCE_PNET"

EnvKey defines environment variable name for forcing usage of PNet in p2p When environment variable of this name is set to "1" the ForcePrivateNetwork variable will be set to true.

Variables

View Source
var ErrNotInPrivateNetwork = NewError("private network was not configured but" +
	" is enforced by the environment")

ErrNotInPrivateNetwork is an error that should be returned by p2p when it tries to dial with ForcePrivateNetwork set and no PNet Protector

View Source
var ForcePrivateNetwork = false

ForcePrivateNetwork is boolean variable that forces usage of PNet in p2p Setting this variable to true or setting P2P_FORCE_PNET environment variable to true will make p2p to require private network protector. If no network protector is provided and this variable is set to true p2p will refuse to connect.

Functions

func IsPNetError

func IsPNetError(err error) bool

IsPNetError checks if given error is PNet Error

func NewError

func NewError(err string) error

NewError creates new Error

Types

type Error

type Error interface {
	IsPNetError() bool
}

Error is error type for ease of detecting PNet errors

type PSK

type PSK []byte

A PSK enables private network implementation to be transparent in p2p. It is used to ensure that peers can only establish connections to other peers that are using the same PSK.

func DecodeV1PSK

func DecodeV1PSK(in io.Reader) (PSK, error)

DecodeV1PSK reads a Multicodec encoded V1 PSK.

Jump to

Keyboard shortcuts

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