ips

package
v1.9.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: BSD-3-Clause Imports: 7 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimedIPPort

type ClaimedIPPort struct {
	// The peer's certificate.
	Cert *x509.Certificate
	// The peer's claimed IP and port.
	IPPort IPPort
	// The time the peer claimed to own this IP and port.
	Timestamp uint64
	// [Cert]'s signature over the IPPort and timestamp.
	// This is used in the networking library to ensure that this IPPort was
	// actually claimed by the peer in question, and not by a malicious peer
	// trying to get us to dial bogus IPPorts.
	Signature []byte
}

A self contained proof that a peer is claiming ownership of an IPPort at a given time.

func (*ClaimedIPPort) BytesLen

func (i *ClaimedIPPort) BytesLen() int

Returns the length of the byte representation of this ClaimedIPPort.

type DynamicIPPort

type DynamicIPPort interface {
	// Returns the IP + port pair.
	IPPort() IPPort
	// Changes the IP.
	SetIP(ip net.IP)
}

An IPPort that can change. Safe for use by multiple goroutines.

func NewDynamicIPPort

func NewDynamicIPPort(ip net.IP, port uint16) DynamicIPPort

type IPPort

type IPPort struct {
	IP   net.IP `json:"ip"`
	Port uint16 `json:"port"`
}

An IP and a port.

func ToIPPort

func ToIPPort(str string) (IPPort, error)

func (IPPort) Equal

func (ipPort IPPort) Equal(other IPPort) bool

func (IPPort) IsZero

func (ipPort IPPort) IsZero() bool

IsZero returns if the IP or port is zeroed out

func (IPPort) String

func (ipPort IPPort) String() string

Jump to

Keyboard shortcuts

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