vpp2pdat

package
v0.0.0-...-bf055c7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package vpp2pdat implements some basic functions over the structures exposed by vpp2papi.

Index

Constants

View Source
const (
	// MinLenID is the minimum length for ID fields
	MinLenID = 4
	// MaxLenID is the maximum length for ID fields
	MaxLenID = 1000
	// MinLenTitle is the minimum length for Title fields
	MinLenTitle = 1
	// MaxLenTitle is the maximum length for Title fields
	MaxLenTitle = 72
	// MinLenDescription is the minimum length for Description fields
	MinLenDescription = 0
	// MaxLenDescription is the maximum length for Description fields
	MaxLenDescription = 10000
	// MinLenURL is the minimum length for URL fields
	MinLenURL = 3
	// MaxLenURL is the maximum length for URL fields
	MaxLenURL = 1000
	// MinLenPubKey is the minimum length for PubKey fields
	MinLenPubKey = 10
	// MaxLenPubKey is the maximum length for PubKey fields
	MaxLenPubKey = 5000
	// MinLenSig is the minimum length for Sig fields
	MinLenSig = 0
	// MaxLenSig is the maximum length for Sig fields
	MaxLenSig = 5000
	// MinLenPasswordHash is the minimum length for PasswordHash fields
	MinLenPasswordHash = 8
	// MaxLenPasswordHash is the maximum length for PasswordHash fields
	MaxLenPasswordHash = 64
)
View Source
const (
	// Host0Title is a default title for the root directory host.
	// It's a purely virtual host, never really instanciated, its
	// private key is forever lost once the public key is generated,
	// therefore it signs some artefacts once, and it's over.
	Host0Title = "Vapor Host 0"
	// Host0URL is the base url where to find the default directory
	// host. It should be a well known, usually up and running server.
	// Technically, once could use any address, but let's say this
	// is just a default seed.
	Host0URL = "http://ufoot.org:8777"
	// Ring0Title is the title of the default directory ring.
	Ring0Title = "Vapor Ring 0"
	// Ring0Description is the description of the default directory ring.
	Ring0Description = "" /* 148-byte string literal not displayed */

	// Ring0Base64RingID contains the ring ID of the default ring0, encoded in base64
	Ring0Base64RingID = "rBYTLlG4OWNQi9Tedd_q0YnMjteYCsTIz0Y6qBOrH205FoVGCDZo4GGtRTbljbMxycElhsnOMTHnkVXIqlTK_w=="
	// Ring0Base64AppID contains the application ID of the default ring0, encoded in base64
	Ring0Base64AppID = "K3kU9SU3EAEiqkAgsYo72g=="
	// Ring0Base64HostPubKey contains the public key of the default ring0, encoded in base64
	Ring0Base64HostPubKey = "" /* 1592-byte string literal not displayed */
	// Ring0Base64RingSig contains the siignature of the default ring0, encoded in base64
	Ring0Base64RingSig = "" /* 384-byte string literal not displayed */

	// DefaultBruijnM default for the m parameter (base) used for Koorde/Bruijn ops.
	DefaultBruijnM = 16
	// DefaultBruijnN default for the n parameter (number of elements) used for Koorde/Bruijn ops.
	DefaultBruijnN = 64
	// DefaultNbCopy default for the number of copies of a key we store within the network.
	DefaultNbCopy = 3
	// DefaultNbStep default to optimizes Bruijn walk by considering only this number
	// of steps in the worst case.
	DefaultNbStep = 8
	// DefaultCallTimeout is the default delay after which a network call is considered
	// stall and cancelled.
	DefaultCallTimeout = 5
	// DefaultSyncDelay is the default delay between two node synchronizations.
	DefaultSyncDelay = 15
	// DefaultDisconnectTimeout is the default delay after which, if a node has been
	// unreachable, it's considered totally unjoinable.
	DefaultDisconnectTimeout = 60
	// DefaultDataLifetime is the amount of time after which keys are automatically deleted
	// to purge the data store, no matter what. Any update on a key extends this duration.
	DefaultDataLifetime = 86400
)
View Source
const (
	// HostPubKeyBufNbBytes gives the number of bytes for a host pub key when used as a map key.
	HostPubKeyBufNbBytes = 16
	// NodeIDBufNbBytes gives the number of bytes for a node ID when used as a map key.
	NodeIDBufNbBytes = 32
	// RingIDBufNbBytes gives the number of bytes for a ring ID when used as a map key.
	RingIDBufNbBytes = 64
	// HostPubKeyShortStringLen gives the number of bytes for a host pub key when used as a short map key.
	HostPubKeyShortStringLen = 5
	// NodeIDShortStringLen gives the number of bytes for a node ID when used as a short map key.
	NodeIDShortStringLen = 7
	// RingIDShortStringLen gives the number of bytes for a ring ID when used as a short map key.
	RingIDShortStringLen = 9
)
View Source
const PackageCopyright = "Copyright (C)  2015, 2016  Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh

PackageCopyright contains a short copyright notice.

View Source
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh

PackageEmail contains a contact email for the package.

View Source
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh

PackageLicense contains a short license information.

View Source
const PackageName = "Vapor Toolkit" // PackageName set by version.sh

PackageName contains a readable name of the package, suitable for display.

View Source
const PackageTarname = "vapor" // PackageTarname set by version.sh

PackageTarname contains a short name of the package, suitable for a filename.

View Source
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh

PackageURL contains the address of the project homepage.

View Source
const VersionMajor = 0 // VersionMajor set by version.sh

VersionMajor is the project major version.

View Source
const VersionMinor = 5 // VersionMinor set by version.sh

VersionMinor is the project minor version.

View Source
const VersionStamp = "c6a4298" // VersionStamp set by version.sh

VersionStamp is the project stamp, possibly changes for each build.

Variables

This section is empty.

Functions

func CheckContextInfo

func CheckContextInfo(context *vpp2papi.ContextInfo) (bool, error)

CheckContextInfo checks wether a contextinfo struct is viable

func CheckDescription

func CheckDescription(description string) (bool, error)

CheckDescription checks that a description is correct

func CheckHostInfo

func CheckHostInfo(host *vpp2papi.HostInfo) (bool, error)

CheckHostInfo checks that a host info struct is filled with correct data.

func CheckID

func CheckID(ID []byte) (bool, error)

CheckID checks that an ID has the right format.

func CheckNodeID

func CheckNodeID(ID []byte) (bool, error)

CheckNodeID checks that an Node ID has the right format.

func CheckNodeInfo

func CheckNodeInfo(node *vpp2papi.NodeInfo) (bool, error)

CheckNodeInfo checks that a node info struct is filled with correct data.

func CheckPasswordHash

func CheckPasswordHash(passwordHash []byte) (bool, error)

CheckPasswordHash checks that a password hash is correct

func CheckPubKey

func CheckPubKey(pubKey []byte) (bool, error)

CheckPubKey checks that a public key is correct

func CheckRingConfig

func CheckRingConfig(config *vpp2papi.RingConfig) (bool, error)

CheckRingConfig checks that the ring config values are within reasonnable ranges.

func CheckRingID

func CheckRingID(ID []byte) (bool, error)

CheckRingID checks that a Ring ID has the right format.

func CheckRingInfo

func CheckRingInfo(ring *vpp2papi.RingInfo) (bool, error)

CheckRingInfo checks that a ring info struct is filled with correct data.

func CheckSig

func CheckSig(sig []byte) (bool, error)

CheckSig checks that a public key is correct

func CheckTitle

func CheckTitle(title string) (bool, error)

CheckTitle checks that a title is correct

func CheckURL

func CheckURL(u string) (bool, error)

CheckURL checks that a a URL is correct

func DefaultRingConfig

func DefaultRingConfig() *vpp2papi.RingConfig

DefaultRingConfig returns a default ring configuration, with 256-bit keys

func HostInfoCheckSig

func HostInfoCheckSig(hostInfo *vpp2papi.HostInfo) (bool, error)

HostInfoCheckSig checks if the host signature is OK, if it's not, returns false and an error.

func HostInfoIsSigned

func HostInfoIsSigned(hostInfo *vpp2papi.HostInfo) bool

HostInfoIsSigned returns true if the has been self-signed. It does not checks if the signature is valid.

func HostInfoSigBytes

func HostInfoSigBytes(hostInfo *vpp2papi.HostInfo) []byte

HostInfoSigBytes returns the byte buffer that needs to be signed.

func HostPubKeyToBuf

func HostPubKeyToBuf(hostPubKey []byte) [HostPubKeyBufNbBytes]byte

HostPubKeyToBuf converts a slice to a fixed-length 16 bytes (128 bits) buffer.

func HostPubKeyToShortString

func HostPubKeyToShortString(hostPubKey []byte) string

HostPubKeyToShortString converts a host public key to a short string of 7 chars

func IsPubKeyExpectedToSign

func IsPubKeyExpectedToSign(pubKey []byte) bool

IsPubKeyExpectedToSign checks wether a public key is likely to be able to sign. This is based on a very simple heuristic: if key is defined and not of a typical hash-size (64 bytes/512 bits) then consider it should be a valid GnuPG public key. Wether this is true must be checked by importing the key but the idea here is just to make a super-fast pre-check.

func NodeIDToBuf

func NodeIDToBuf(nodeID []byte) [NodeIDBufNbBytes]byte

NodeIDToBuf converts a slice to a fixed-length 32 bytes (256 bits) buffer.

func NodeIDToShortString

func NodeIDToShortString(nodeID []byte) string

NodeIDToShortString converts a a host node id to a short string or 8 chars

func NodeInfoCheckSig

func NodeInfoCheckSig(nodeInfo *vpp2papi.NodeInfo) (int, error)

NodeInfoCheckSig checks if the node signature is OK, if it's not, returns 0 and an error. If it's OK, returns the number of zeroes in the signature hash.

func NodeInfoIsSigned

func NodeInfoIsSigned(nodeInfo *vpp2papi.NodeInfo) bool

NodeInfoIsSigned returns true if the node has been signed by corresponding host. It does not checks if the signature is valid.

func NodeInfoSigBytes

func NodeInfoSigBytes(nodeInfo *vpp2papi.NodeInfo) []byte

NodeInfoSigBytes returns the byte buffer that needs to be signed.

func RingIDToBuf

func RingIDToBuf(ringID []byte) [RingIDBufNbBytes]byte

RingIDToBuf converts a slice to a fixed-length 64 bytes (512 bits) buffer.

func RingIDToShortString

func RingIDToShortString(ringID []byte) string

RingIDToShortString converts a ring id to a short string of 9 chars

func RingInfoCheckSig

func RingInfoCheckSig(ringInfo *vpp2papi.RingInfo) (int, error)

RingInfoCheckSig checks if the ring signature is OK, if it's not, returns 0 and an error. If it's OK, returns the number of zeroes in the signature hash.

func RingInfoIsSigned

func RingInfoIsSigned(ringInfo *vpp2papi.RingInfo) bool

RingInfoIsSigned returns true if the ring has been signed by corresponding host. It does not checks if the signature is valid.

func RingInfoSigBytes

func RingInfoSigBytes(ringInfo *vpp2papi.RingInfo) []byte

RingInfoSigBytes returns the byte buffer that needs to be signed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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