ndf

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: BSD-2-Clause Imports: 8 Imported by: 22

Documentation

Index

Constants

View Source
const (
	Active = Status(iota)
	Stale
	NumTypes
)
View Source
const NO_NDF = "Contacted server does not have an ndf to give"

NO_NDF is a string that the permissioning server responds with when a member of the network requests an NDF from it but the NDF is not yet available.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressSpace added in v0.0.4

type AddressSpace struct {
	Size      uint8
	Timestamp time.Time
}

type Gateway

type Gateway struct {
	ID             []byte `json:"Id"`
	Address        string
	TlsCertificate string `json:"Tls_certificate"`
	Bin            region.GeoBin
}

Gateway contains the connection and identity information of a gateway on the network.

func (*Gateway) GetGatewayId

func (g *Gateway) GetGatewayId() (*id.ID, error)

GetGatewayId unmarshalls the Gateway's ID bytes into an id.ID and returns it.

type Group

type Group struct {
	Prime      string
	SmallPrime string `json:"Small_prime"`
	Generator  string
}

Group contains the information used to reconstruct a cyclic group.

func (*Group) String

func (g *Group) String() (string, error)

type NetworkDefinition

type NetworkDefinition struct {
	Timestamp     time.Time
	Gateways      []Gateway
	Nodes         []Node
	Registration  Registration
	Notification  Notification
	UDB           UDB   `json:"Udb"`
	E2E           Group `json:"E2e"`
	CMIX          Group `json:"Cmix"`
	AddressSpace  []AddressSpace
	ClientVersion string
	// Ids that bypass rate limiting
	WhitelistedIds []string
	// Ips that bypass rate limiting
	WhitelistedIpAddresses []string
	// Details on how gateways will rate limit clients
	RateLimits RateLimiting
}

NetworkDefinition structure hold connection and network information. It matches the JSON structure generated in Terraform.

func Unmarshal added in v0.0.4

func Unmarshal(data []byte) (*NetworkDefinition, error)

Unmarshal parses the JSON encoded data and returns the resulting NetworkDefinition.

func (*NetworkDefinition) DeepCopy added in v0.0.4

func (ndf *NetworkDefinition) DeepCopy() *NetworkDefinition

DeepCopy returns a deep copy of the NDF. Note that this function is intentionally verbose so that tests will fail if this function is not updated when the NetworkDefinition is modified.

func (*NetworkDefinition) Marshal

func (ndf *NetworkDefinition) Marshal() (data []byte, err error)

Marshal returns the JSON encoding of the NDF.

func (*NetworkDefinition) Serialize

func (ndf *NetworkDefinition) Serialize() []byte

Serialize serializes the NetworkDefinition into a byte slice.

func (*NetworkDefinition) StripNdf

func (ndf *NetworkDefinition) StripNdf() *NetworkDefinition

StripNdf returns a stripped down copy of the NetworkDefinition to be used by Clients.

type Node

type Node struct {
	ID             []byte `json:"Id"`
	Address        string
	TlsCertificate string `json:"Tls_certificate"`
	Ed25519        []byte
	Status
}

Node contains the connection and identity information of a node on the network.

func (*Node) GetNodeId

func (n *Node) GetNodeId() (*id.ID, error)

GetNodeId unmarshalls the Node's ID bytes into an id.ID and returns it.

type Notification

type Notification struct {
	Address        string
	TlsCertificate string `json:"Tls_certificate"`
}

Notification contains the connection information for the notification bot.

type RateLimiting added in v0.0.4

type RateLimiting struct {
	Capacity     uint
	LeakedTokens uint
	LeakDuration uint64
}

RateLimiting contains details on how to rate limit clients.

type Registration

type Registration struct {
	Address                   string
	ClientRegistrationAddress string
	TlsCertificate            string `json:"Tls_certificate"`
	EllipticPubKey            string
}

Registration contains the connection information for the permissioning server.

type Status added in v0.0.4

type Status uint8

func (Status) String added in v0.0.4

func (s Status) String() string

type UDB

type UDB struct {
	ID                          []byte `json:"Id"`
	Cert                        string `json:"Cert"`
	Address                     string `json:"Address"`
	DhPubKey                    []byte `json:"DhPubKey"`
	ChannelSigningPubKeyEd25519 []byte `json:"ChannelSigningPubKeyEd25519"`
}

UDB contains the ID, public key in PEM format, address, and DH public key for user discovery.

Jump to

Keyboard shortcuts

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