Documentation ¶
Overview ¶
Package vpp2pdat implements some basic functions over the structures exposed by vpp2papi.
Index ¶
- Constants
- func CheckContextInfo(context *vpp2papi.ContextInfo) (bool, error)
- func CheckDescription(description string) (bool, error)
- func CheckHostInfo(host *vpp2papi.HostInfo) (bool, error)
- func CheckID(ID []byte) (bool, error)
- func CheckNodeID(ID []byte) (bool, error)
- func CheckNodeInfo(node *vpp2papi.NodeInfo) (bool, error)
- func CheckPasswordHash(passwordHash []byte) (bool, error)
- func CheckPubKey(pubKey []byte) (bool, error)
- func CheckRingConfig(config *vpp2papi.RingConfig) (bool, error)
- func CheckRingID(ID []byte) (bool, error)
- func CheckRingInfo(ring *vpp2papi.RingInfo) (bool, error)
- func CheckSig(sig []byte) (bool, error)
- func CheckTitle(title string) (bool, error)
- func CheckURL(u string) (bool, error)
- func DefaultRingConfig() *vpp2papi.RingConfig
- func HostInfoCheckSig(hostInfo *vpp2papi.HostInfo) (bool, error)
- func HostInfoIsSigned(hostInfo *vpp2papi.HostInfo) bool
- func HostInfoSigBytes(hostInfo *vpp2papi.HostInfo) []byte
- func HostPubKeyToBuf(hostPubKey []byte) [HostPubKeyBufNbBytes]byte
- func HostPubKeyToShortString(hostPubKey []byte) string
- func IsPubKeyExpectedToSign(pubKey []byte) bool
- func NodeIDToBuf(nodeID []byte) [NodeIDBufNbBytes]byte
- func NodeIDToShortString(nodeID []byte) string
- func NodeInfoCheckSig(nodeInfo *vpp2papi.NodeInfo) (int, error)
- func NodeInfoIsSigned(nodeInfo *vpp2papi.NodeInfo) bool
- func NodeInfoSigBytes(nodeInfo *vpp2papi.NodeInfo) []byte
- func RingIDToBuf(ringID []byte) [RingIDBufNbBytes]byte
- func RingIDToShortString(ringID []byte) string
- func RingInfoCheckSig(ringInfo *vpp2papi.RingInfo) (int, error)
- func RingInfoIsSigned(ringInfo *vpp2papi.RingInfo) bool
- func RingInfoSigBytes(ringInfo *vpp2papi.RingInfo) []byte
Constants ¶
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 )
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 )
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 )
const PackageCopyright = "Copyright (C) 2015, 2016 Christian Mauduit <ufoot@ufoot.org>" // PackageCopyright set by version.sh
PackageCopyright contains a short copyright notice.
const PackageEmail = "ufoot@ufoot.org" // PackageEmail set by version.sh
PackageEmail contains a contact email for the package.
const PackageLicense = "GNU GPL v3" // PackageLicense set by version.sh
PackageLicense contains a short license information.
const PackageName = "Vapor Toolkit" // PackageName set by version.sh
PackageName contains a readable name of the package, suitable for display.
const PackageTarname = "vapor" // PackageTarname set by version.sh
PackageTarname contains a short name of the package, suitable for a filename.
const PackageURL = "https://github.com/ufoot/vapor" // PackageURL set by version.sh
PackageURL contains the address of the project homepage.
const VersionMajor = 0 // VersionMajor set by version.sh
VersionMajor is the project major version.
const VersionMinor = 5 // VersionMinor set by version.sh
VersionMinor is the project minor version.
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 ¶
CheckDescription checks that a description is correct
func CheckHostInfo ¶
CheckHostInfo checks that a host info struct is filled with correct data.
func CheckNodeID ¶
CheckNodeID checks that an Node ID has the right format.
func CheckNodeInfo ¶
CheckNodeInfo checks that a node info struct is filled with correct data.
func CheckPasswordHash ¶
CheckPasswordHash checks that a password hash is correct
func CheckPubKey ¶
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 ¶
CheckRingID checks that a Ring ID has the right format.
func CheckRingInfo ¶
CheckRingInfo checks that a ring info struct is filled with correct data.
func CheckTitle ¶
CheckTitle checks that a title is correct
func DefaultRingConfig ¶
func DefaultRingConfig() *vpp2papi.RingConfig
DefaultRingConfig returns a default ring configuration, with 256-bit keys
func HostInfoCheckSig ¶
HostInfoCheckSig checks if the host signature is OK, if it's not, returns false and an error.
func HostInfoIsSigned ¶
HostInfoIsSigned returns true if the has been self-signed. It does not checks if the signature is valid.
func HostInfoSigBytes ¶
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 ¶
HostPubKeyToShortString converts a host public key to a short string of 7 chars
func IsPubKeyExpectedToSign ¶
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 ¶
NodeIDToShortString converts a a host node id to a short string or 8 chars
func NodeInfoCheckSig ¶
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 ¶
NodeInfoIsSigned returns true if the node has been signed by corresponding host. It does not checks if the signature is valid.
func NodeInfoSigBytes ¶
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 ¶
RingIDToShortString converts a ring id to a short string of 9 chars
func RingInfoCheckSig ¶
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 ¶
RingInfoIsSigned returns true if the ring has been signed by corresponding host. It does not checks if the signature is valid.
func RingInfoSigBytes ¶
RingInfoSigBytes returns the byte buffer that needs to be signed.
Types ¶
This section is empty.