diff --git a/.gitignore b/.gitignore index 60c7ea2..634dad5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ go-i2p .idea/ router.info log +*.gv +diff +err \ No newline at end of file diff --git a/Makefile b/Makefile index 88db3ce..1155718 100644 --- a/Makefile +++ b/Makefile @@ -64,11 +64,5 @@ info: release: github-release release -u go-i2p -r go-i2p -n "${RELEASE_VERSION}" -t "${RELEASE_TAG}" -d "${RELEASE_DESCRIPTION}" -p -callvis: - go-callvis -file index.html -format svg -group pkg,type github.com/go-i2p/go-i2p/ - godoc: - find lib -type d -exec bash -c "ls {}/*.go && godocdown -o ./{}/doc.md ./{}" \; - -gocallvis: - find lib -type d -exec bash -c "ls {}/*.go && go-callvis -focus github.com/go-i2p/go-i2p/{} -file ./{}/index.html -format svg -group pkg,type github.com/go-i2p/go-i2p/{}" \; + ./callgraph.sh diff --git a/callgraph.sh b/callgraph.sh index 6c48daf..f88b94f 100755 --- a/callgraph.sh +++ b/callgraph.sh @@ -12,6 +12,7 @@ for dir in $dirs; do packageLine=$(grep -E "^package" $file) package=$(echo $packageLine | awk '{print $2}') echo "Generating callgraph for $package" - go-callvis -nostd -focus "$package" -group pkg,type -format svg -file $dir/$package.svg "github.com/go-i2p/go-i2p/$dir" - git add -v "$dir/$package.svg" + go-callvis -nostd -focus "$package" -group pkg,type -format svg -file $dir/$package "github.com/go-i2p/go-i2p/$dir" + godocdown -template template.md -o "$dir/doc.md" "./$dir" + git add -v "$dir/$package.svg" "$dir/doc.md" done \ No newline at end of file diff --git a/lib/bootstrap/bootstrap.svg b/lib/bootstrap/bootstrap.svg new file mode 100644 index 0000000..947c327 --- /dev/null +++ b/lib/bootstrap/bootstrap.svg @@ -0,0 +1,13 @@ + + + + + + +gocallvis + + + diff --git a/lib/bootstrap/doc.md b/lib/bootstrap/doc.md index 091cdcd..fd64940 100644 --- a/lib/bootstrap/doc.md +++ b/lib/bootstrap/doc.md @@ -21,3 +21,35 @@ type Bootstrap interface { ``` interface defining a way to bootstrap into the i2p network + +# bootstrap +-- + import "github.com/go-i2p/go-i2p/lib/bootstrap" + +provides generic interfaces for initial bootstrap into network and network +### reseeding + +![bootstrap.svg](bootstrap) + +## Usage + +#### type Bootstrap + +```go +type Bootstrap interface { + // get more peers for bootstrap + // try obtaining at most n router infos + // if n is 0 then try obtaining as many router infos as possible + // returns nil and error if we cannot fetch ANY router infos + // returns a channel that yields 1 slice of router infos containing n or fewer router infos, caller must close channel after use + GetPeers(n int) (chan []router_info.RouterInfo, error) +} +``` + +interface defining a way to bootstrap into the i2p network + + + +bootstrap + +github.com/go-i2p/go-i2p/lib/bootstrap diff --git a/lib/common/base32/base32.svg b/lib/common/base32/base32.svg new file mode 100644 index 0000000..947c327 --- /dev/null +++ b/lib/common/base32/base32.svg @@ -0,0 +1,13 @@ + + + + + + +gocallvis + + + diff --git a/lib/common/base32/doc.md b/lib/common/base32/doc.md index b77c56a..e163cd7 100644 --- a/lib/common/base32/doc.md +++ b/lib/common/base32/doc.md @@ -31,3 +31,45 @@ DecodeString decodes base64 string to []byte I2PEncoding func EncodeToString(data []byte) string ``` EncodeToString encodes []byte to a base32 string using I2PEncoding + +# base32 +-- + import "github.com/go-i2p/go-i2p/lib/common/base32" + +Package base32 implmenets utilities for encoding and decoding text using I2P's +### alphabet + +![base32.svg](base32) + +## Usage + +```go +const I2PEncodeAlphabet = "abcdefghijklmnopqrstuvwxyz234567" +``` +I2PEncodeAlphabet is the base32 encoding used throughout I2P. RFC 3548 using +lowercase characters. + +```go +var I2PEncoding *b32.Encoding = b32.NewEncoding(I2PEncodeAlphabet) +``` +I2PEncoding is the standard base32 encoding used through I2P. + +#### func DecodeString + +```go +func DecodeString(data string) ([]byte, error) +``` +DecodeString decodes base64 string to []byte I2PEncoding + +#### func EncodeToString + +```go +func EncodeToString(data []byte) string +``` +EncodeToString encodes []byte to a base32 string using I2PEncoding + + + +base32 + +github.com/go-i2p/go-i2p/lib/common/base32 diff --git a/lib/common/base64/base64.svg b/lib/common/base64/base64.svg new file mode 100644 index 0000000..947c327 --- /dev/null +++ b/lib/common/base64/base64.svg @@ -0,0 +1,13 @@ + + + + + + +gocallvis + + + diff --git a/lib/common/base64/doc.md b/lib/common/base64/doc.md index 511b4ce..0a397d7 100644 --- a/lib/common/base64/doc.md +++ b/lib/common/base64/doc.md @@ -31,3 +31,45 @@ DecodeString decodes base64 string to []byte I2PEncoding func EncodeToString(data []byte) string ``` I2PEncoding is the standard base64 encoding used through I2P. + +# base64 +-- + import "github.com/go-i2p/go-i2p/lib/common/base64" + +Package base64 implmenets utilities for encoding and decoding text using I2P's +### alphabet + +![base64.svg](base64) + +## Usage + +```go +const I2PEncodeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~" +``` +I2PEncodeAlphabet is the base64 encoding used throughout I2P. RFC 4648 with "/"" +replaced with "~", and "+" replaced with "-". + +```go +var I2PEncoding *b64.Encoding = b64.NewEncoding(I2PEncodeAlphabet) +``` +I2PEncoding is the standard base64 encoding used through I2P. + +#### func DecodeString + +```go +func DecodeString(str string) ([]byte, error) +``` +DecodeString decodes base64 string to []byte I2PEncoding + +#### func EncodeToString + +```go +func EncodeToString(data []byte) string +``` +I2PEncoding is the standard base64 encoding used through I2P. + + + +base64 + +github.com/go-i2p/go-i2p/lib/common/base64 diff --git a/lib/common/certificate/certificate.svg b/lib/common/certificate/certificate.svg new file mode 100644 index 0000000..decd62b --- /dev/null +++ b/lib/common/certificate/certificate.svg @@ -0,0 +1,640 @@ + + + + + + +gocallvis + + +cluster_focus + +certificate + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate + + +(*Certificate) + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateWithType + + +NewCertificateWithType + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + +NewIntegerFromInt + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateWithType->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateWithType->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.readCertificate + + +readCertificate + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.readCertificate->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.readCertificate->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.readCertificate->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.readCertificate->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.readCertificate->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateDeux + + +NewCertificateDeux + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateDeux->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateDeux->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateDeux->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateDeux->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.GetSignatureTypeFromCertificate + + +GetSignatureTypeFromCertificate + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + +Type + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.GetSignatureTypeFromCertificate->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.GetSignatureTypeFromCertificate->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate + + +ReadCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate->github.com/go-i2p/go-i2p/lib/common/certificate.readCertificate + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).ExcessBytes + + +ExcessBytes + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).ExcessBytes + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).RawBytes + + +RawBytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + +Bytes + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).RawBytes->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).RawBytes->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).RawBytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).ExcessBytes->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).ExcessBytes->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).ExcessBytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes + + +Bytes + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + +Data + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + +Length + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).length + + +length + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).length->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/certificate/doc.md b/lib/common/certificate/doc.md index 24712f2..1de36f7 100644 --- a/lib/common/certificate/doc.md +++ b/lib/common/certificate/doc.md @@ -23,6 +23,12 @@ const CERT_MIN_SIZE = 3 CERT_MIN_SIZE is the minimum size of a valid Certificate in []byte 1 byte for type 2 bytes for payload length +#### func GetSignatureTypeFromCertificate + +```go +func GetSignatureTypeFromCertificate(cert Certificate) (int, error) +``` + #### type Certificate ```go @@ -37,10 +43,22 @@ https://geti2p.net/spec/common-structures#certificate #### func NewCertificate ```go -func NewCertificate(data []byte) (certificate Certificate, err error) +func NewCertificate() *Certificate ``` -NewCertificate creates a new Certficiate from []byte returns err if the -certificate is too short or if the payload doesn't match specified length. +NewCertificate creates a new Certificate with default NULL type + +#### func NewCertificateDeux + +```go +func NewCertificateDeux(certType int, payload []byte) (*Certificate, error) +``` + +#### func NewCertificateWithType + +```go +func NewCertificateWithType(certType uint8, payload []byte) (*Certificate, error) +``` +NewCertificateWithType creates a new Certificate with specified type and payload #### func ReadCertificate @@ -96,3 +114,129 @@ func (c *Certificate) Type() (cert_type int) ``` Type returns the Certificate type specified in the first byte of the Certificate, + +# certificate +-- + import "github.com/go-i2p/go-i2p/lib/common/certificate" + + + +![certificate.svg](certificate) + +## Usage + +```go +const ( + CERT_NULL = iota + CERT_HASHCASH + CERT_HIDDEN + CERT_SIGNED + CERT_MULTIPLE + CERT_KEY +) +``` +Certificate Types + +```go +const CERT_MIN_SIZE = 3 +``` +CERT_MIN_SIZE is the minimum size of a valid Certificate in []byte 1 byte for +type 2 bytes for payload length + +#### func GetSignatureTypeFromCertificate + +```go +func GetSignatureTypeFromCertificate(cert Certificate) (int, error) +``` + +#### type Certificate + +```go +type Certificate struct { +} +``` + +Certificate is the representation of an I2P Certificate. + +https://geti2p.net/spec/common-structures#certificate + +#### func NewCertificate + +```go +func NewCertificate() *Certificate +``` +NewCertificate creates a new Certificate with default NULL type + +#### func NewCertificateDeux + +```go +func NewCertificateDeux(certType int, payload []byte) (*Certificate, error) +``` + +#### func NewCertificateWithType + +```go +func NewCertificateWithType(certType uint8, payload []byte) (*Certificate, error) +``` +NewCertificateWithType creates a new Certificate with specified type and payload + +#### func ReadCertificate + +```go +func ReadCertificate(data []byte) (certificate Certificate, remainder []byte, err error) +``` +ReadCertificate creates a Certificate from []byte and returns any ExcessBytes at +the end of the input. returns err if the certificate could not be read. + +#### func (*Certificate) Bytes + +```go +func (c *Certificate) Bytes() []byte +``` +Bytes returns the entire certificate in []byte form, trims payload to specified +length. + +#### func (*Certificate) Data + +```go +func (c *Certificate) Data() (data []byte) +``` +Data returns the payload of a Certificate, payload is trimmed to the specified +length. + +#### func (*Certificate) ExcessBytes + +```go +func (c *Certificate) ExcessBytes() []byte +``` +ExcessBytes returns the excess bytes in a certificate found after the specified +payload length. + +#### func (*Certificate) Length + +```go +func (c *Certificate) Length() (length int) +``` +Length returns the payload length of a Certificate. + +#### func (*Certificate) RawBytes + +```go +func (c *Certificate) RawBytes() []byte +``` +RawBytes returns the entire certificate in []byte form, includes excess payload +data. + +#### func (*Certificate) Type + +```go +func (c *Certificate) Type() (cert_type int) +``` +Type returns the Certificate type specified in the first byte of the +Certificate, + + + +certificate + +github.com/go-i2p/go-i2p/lib/common/certificate diff --git a/lib/common/data/data.svg b/lib/common/data/data.svg new file mode 100644 index 0000000..b919c85 --- /dev/null +++ b/lib/common/data/data.svg @@ -0,0 +1,1321 @@ + + + + + + +gocallvis + + +cluster_focus + +data + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.MappingValues + + +(MappingValues) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Mapping + + +(Mapping) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.I2PString + + +(I2PString) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Date + + +(Date) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/data.Mapping + + +(*Mapping) + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadDate + + +ReadDate + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadDate->(github.com/go-i2p/go-i2p/lib/common/data.Date).Int + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadDate->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadDate->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadDate->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadDate->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.intFromBytes + + +intFromBytes + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewMapping + + +NewMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping + + +ReadMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewMapping->github.com/go-i2p/go-i2p/lib/common/data.ReadMapping + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + +Values + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewMapping->(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewMapping->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewMapping->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + +NewInteger + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues + + +ReadMappingValues + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMapping->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadInteger + + +ReadInteger + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewInteger->github.com/go-i2p/go-i2p/lib/common/data.ReadInteger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString + + +ReadI2PString + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.stopValueRead + + +stopValueRead + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->github.com/go-i2p/go-i2p/lib/common/data.stopValueRead + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.beginsWith + + +beginsWith + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->github.com/go-i2p/go-i2p/lib/common/data.beginsWith + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + +Data + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Printf + + +Printf + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadMappingValues->(*github.com/sirupsen/logrus.Logger).Printf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length + + +Length + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->(*github.com/go-i2p/logger.Logger).Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.stopValueRead->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.stopValueRead->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.beginsWith->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.beginsWith->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + +NewIntegerFromInt + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt->github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping + + +GoMapToMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + +ToI2PString + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ValuesToMapping + + +ValuesToMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping->github.com/go-i2p/go-i2p/lib/common/data.ValuesToMapping + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ValuesToMapping->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.mappingOrder + + +mappingOrder + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ValuesToMapping->github.com/go-i2p/go-i2p/lib/common/data.mappingOrder + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ValuesToMapping->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ValuesToMapping->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/data.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.init->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate + + +NewDate + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate->github.com/go-i2p/go-i2p/lib/common/data.ReadDate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate->(github.com/go-i2p/go-i2p/lib/common/data.Date).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.WrapErrors + + +WrapErrors + + + + + +github.com/go-i2p/go-i2p/lib/common/data.WrapErrors->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data + + +Data + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + +Bytes + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data->(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).HasDuplicateKeys + + +HasDuplicateKeys + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).HasDuplicateKeys->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).HasDuplicateKeys->(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).HasDuplicateKeys->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).HasDuplicateKeys->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).HasDuplicateKeys->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Int->github.com/go-i2p/go-i2p/lib/common/data.intFromBytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Int->(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + +Time + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Time->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length->github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int->github.com/go-i2p/go-i2p/lib/common/data.intFromBytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get + + +Get + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/data/doc.md b/lib/common/data/doc.md index c972402..2dceebf 100644 --- a/lib/common/data/doc.md +++ b/lib/common/data/doc.md @@ -22,6 +22,16 @@ const STRING_MAX_SIZE = 255 STRING_MAX_SIZE is the maximum number of bytes that can be stored in an I2P string +```go +var ( + ErrZeroLength = oops.Errorf("error parsing string: zero length") + ErrDataTooShort = oops.Errorf("string parsing warning: string data is shorter than specified by length") + ErrDataTooLong = oops.Errorf("string parsing warning: string contains data beyond length") + ErrLengthMismatch = oops.Errorf("error reading I2P string, length does not match data") + ErrMappingLengthMismatch = oops.Errorf("warning parsing mapping: mapping length exceeds provided data") +) +``` + #### func PrintErrors ```go @@ -207,7 +217,7 @@ Bytes returns the raw []byte content of an Integer. ```go func (i Integer) Int() int ``` -Int returns the Date as a Go integer +Int returns the Integer as a Go integer #### type Mapping @@ -295,3 +305,319 @@ occurred during parsing. ```go func (m MappingValues) Get(key I2PString) I2PString ``` + +# data +-- + import "github.com/go-i2p/go-i2p/lib/common/data" + +Package data implements common data structures used in higher level structures. + +![data.svg](data) + +## Usage + +```go +const DATE_SIZE = 8 +``` +DATE_SIZE is the length in bytes of an I2P Date. + +```go +const MAX_INTEGER_SIZE = 8 +``` +MAX_INTEGER_SIZE is the maximum length of an I2P integer in bytes. + +```go +const STRING_MAX_SIZE = 255 +``` +STRING_MAX_SIZE is the maximum number of bytes that can be stored in an I2P +string + +```go +var ( + ErrZeroLength = oops.Errorf("error parsing string: zero length") + ErrDataTooShort = oops.Errorf("string parsing warning: string data is shorter than specified by length") + ErrDataTooLong = oops.Errorf("string parsing warning: string contains data beyond length") + ErrLengthMismatch = oops.Errorf("error reading I2P string, length does not match data") + ErrMappingLengthMismatch = oops.Errorf("warning parsing mapping: mapping length exceeds provided data") +) +``` + +#### func PrintErrors + +```go +func PrintErrors(errs []error) +``` +PrintErrors prints a formatted list of errors to the console. + +#### func WrapErrors + +```go +func WrapErrors(errs []error) error +``` +WrapErrors compiles a slice of errors and returns them wrapped together as a +single error. + +#### type Date + +```go +type Date [8]byte +``` + +Date is the represenation of an I2P Date. + +https://geti2p.net/spec/common-structures#date + +#### func NewDate + +```go +func NewDate(data []byte) (date *Date, remainder []byte, err error) +``` +NewDate creates a new Date from []byte using ReadDate. Returns a pointer to Date +unlike ReadDate. + +#### func ReadDate + +```go +func ReadDate(data []byte) (date Date, remainder []byte, err error) +``` +ReadDate creates a Date from []byte using the first DATE_SIZE bytes. Any data +after DATE_SIZE is returned as a remainder. + +#### func (Date) Bytes + +```go +func (i Date) Bytes() []byte +``` +Bytes returns the raw []byte content of a Date. + +#### func (Date) Int + +```go +func (i Date) Int() int +``` +Int returns the Date as a Go integer. + +#### func (Date) Time + +```go +func (date Date) Time() (date_time time.Time) +``` +Time takes the value stored in date as an 8 byte big-endian integer representing +the number of milliseconds since the beginning of unix time and converts it to a +Go time.Time struct. + +#### type Hash + +```go +type Hash [32]byte +``` + +Hash is the represenation of an I2P Hash. + +https://geti2p.net/spec/common-structures#hash + +#### func HashData + +```go +func HashData(data []byte) (h Hash) +``` +HashData returns the SHA256 sum of a []byte input as Hash. + +#### func HashReader + +```go +func HashReader(r io.Reader) (h Hash, err error) +``` +HashReader returns the SHA256 sum from all data read from an io.Reader. return +error if one occurs while reading from reader + +#### func (Hash) Bytes + +```go +func (h Hash) Bytes() [32]byte +``` + +#### type I2PString + +```go +type I2PString []byte +``` + +I2PString is the represenation of an I2P String. + +https://geti2p.net/spec/common-structures#string + +#### func ReadI2PString + +```go +func ReadI2PString(data []byte) (str I2PString, remainder []byte, err error) +``` +ReadI2PString returns I2PString from a []byte. The remaining bytes after the +specified length are also returned. Returns a list of errors that occurred +during parsing. + +#### func ToI2PString + +```go +func ToI2PString(data string) (str I2PString, err error) +``` +ToI2PString converts a Go string to an I2PString. Returns error if the string +exceeds STRING_MAX_SIZE. + +#### func (I2PString) Data + +```go +func (str I2PString) Data() (data string, err error) +``` +Data returns the I2PString content as a string trimmed to the specified length +and not including the length byte. Returns error encountered by Length. + +#### func (I2PString) Length + +```go +func (str I2PString) Length() (length int, err error) +``` +Length returns the length specified in the first byte. Returns error if the +specified does not match the actual length or the string is otherwise invalid. + +#### type Integer + +```go +type Integer []byte +``` + +Integer is the represenation of an I2P Integer. + +https://geti2p.net/spec/common-structures#integer + +#### func NewInteger + +```go +func NewInteger(bytes []byte, size int) (integer *Integer, remainder []byte, err error) +``` +NewInteger creates a new Integer from []byte using ReadInteger. Limits the +length of the created Integer to MAX_INTEGER_SIZE. Returns a pointer to Integer +unlike ReadInteger. + +#### func NewIntegerFromInt + +```go +func NewIntegerFromInt(value int, size int) (integer *Integer, err error) +``` +NewIntegerFromInt creates a new Integer from a Go integer of a specified []byte +length. + +#### func ReadInteger + +```go +func ReadInteger(bytes []byte, size int) (Integer, []byte) +``` +ReadInteger returns an Integer from a []byte of specified length. The remaining +bytes after the specified length are also returned. + +#### func (Integer) Bytes + +```go +func (i Integer) Bytes() []byte +``` +Bytes returns the raw []byte content of an Integer. + +#### func (Integer) Int + +```go +func (i Integer) Int() int +``` +Int returns the Integer as a Go integer + +#### type Mapping + +```go +type Mapping struct { +} +``` + +Mapping is the represenation of an I2P Mapping. + +https://geti2p.net/spec/common-structures#mapping + +#### func GoMapToMapping + +```go +func GoMapToMapping(gomap map[string]string) (mapping *Mapping, err error) +``` +GoMapToMapping converts a Go map of unformatted strings to *Mapping. + +#### func NewMapping + +```go +func NewMapping(bytes []byte) (values *Mapping, remainder []byte, err []error) +``` +NewMapping creates a new *Mapping from []byte using ReadMapping. Returns a +pointer to Mapping unlike ReadMapping. + +#### func ReadMapping + +```go +func ReadMapping(bytes []byte) (mapping Mapping, remainder []byte, err []error) +``` +ReadMapping returns Mapping from a []byte. The remaining bytes after the +specified length are also returned. Returns a list of errors that occurred +during parsing. + +#### func ValuesToMapping + +```go +func ValuesToMapping(values MappingValues) *Mapping +``` +ValuesToMapping creates a *Mapping using MappingValues. The values are sorted in +the order defined in mappingOrder. + +#### func (*Mapping) Data + +```go +func (mapping *Mapping) Data() []byte +``` +Data returns a Mapping in its []byte form. + +#### func (*Mapping) HasDuplicateKeys + +```go +func (mapping *Mapping) HasDuplicateKeys() bool +``` +HasDuplicateKeys returns true if two keys in a mapping are identical. + +#### func (Mapping) Values + +```go +func (mapping Mapping) Values() MappingValues +``` +Values returns the values contained in a Mapping as MappingValues. + +#### type MappingValues + +```go +type MappingValues [][2]I2PString +``` + +MappingValues represents the parsed key value pairs inside of an I2P Mapping. + +#### func ReadMappingValues + +```go +func ReadMappingValues(remainder []byte, map_length Integer) (values *MappingValues, remainder_bytes []byte, errs []error) +``` +ReadMappingValues returns *MappingValues from a []byte. The remaining bytes +after the specified length are also returned. Returns a list of errors that +occurred during parsing. + +#### func (MappingValues) Get + +```go +func (m MappingValues) Get(key I2PString) I2PString +``` + + + +data + +github.com/go-i2p/go-i2p/lib/common/data diff --git a/lib/common/destination/destination.svg b/lib/common/destination/destination.svg new file mode 100644 index 0000000..7830903 --- /dev/null +++ b/lib/common/destination/destination.svg @@ -0,0 +1,340 @@ + + + + + + +gocallvis + + +cluster_focus + +destination + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert + + +keys_and_cert + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(*KeysAndCert) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/destination.Destination + + +(Destination) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/certificate + + +certificate + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate + + +(*Certificate) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/base64 + + +base64 + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/base32 + + +base32 + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination + + +ReadDestination + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + +ReadKeysAndCert + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/base32.EncodeToString + + +EncodeToString + + + + + +github.com/go-i2p/go-i2p/lib/common/base64.EncodeToString + + +EncodeToString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address + + +Base32Address + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address->github.com/go-i2p/go-i2p/lib/common/base32.EncodeToString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + +Certificate + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64 + + +Base64 + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64->github.com/go-i2p/go-i2p/lib/common/base64.EncodeToString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/destination/doc.md b/lib/common/destination/doc.md index fff8c39..bd63bba 100644 --- a/lib/common/destination/doc.md +++ b/lib/common/destination/doc.md @@ -40,3 +40,54 @@ Base32Address returns the I2P base32 address for this Destination. func (destination Destination) Base64() string ``` Base64 returns the I2P base64 address for this Destination. + +# destination +-- + import "github.com/go-i2p/go-i2p/lib/common/destination" + +Package destination implements the I2P Destination common data structure + +![destination.svg](destination) + +## Usage + +#### type Destination + +```go +type Destination struct { + KeysAndCert +} +``` + +Destination is the represenation of an I2P Destination. + +https://geti2p.net/spec/common-structures#destination + +#### func ReadDestination + +```go +func ReadDestination(data []byte) (destination Destination, remainder []byte, err error) +``` +ReadDestination returns Destination from a []byte. The remaining bytes after the +specified length are also returned. Returns a list of errors that occurred +during parsing. + +#### func (Destination) Base32Address + +```go +func (destination Destination) Base32Address() (str string) +``` +Base32Address returns the I2P base32 address for this Destination. + +#### func (Destination) Base64 + +```go +func (destination Destination) Base64() string +``` +Base64 returns the I2P base64 address for this Destination. + + + +destination + +github.com/go-i2p/go-i2p/lib/common/destination diff --git a/lib/common/fuzz/certificate/doc.md b/lib/common/fuzz/certificate/doc.md index 64dd643..3392e15 100644 --- a/lib/common/fuzz/certificate/doc.md +++ b/lib/common/fuzz/certificate/doc.md @@ -10,3 +10,25 @@ ```go func Fuzz(data []byte) int ``` + +# exportable +-- + import "github.com/go-i2p/go-i2p/lib/common/fuzz/certificate" + + + +![exportable.svg](exportable) + +## Usage + +#### func Fuzz + +```go +func Fuzz(data []byte) int +``` + + + +exportable + +github.com/go-i2p/go-i2p/lib/common/fuzz/certificate diff --git a/lib/common/fuzz/certificate/exportable.svg b/lib/common/fuzz/certificate/exportable.svg new file mode 100644 index 0000000..f4f0a87 --- /dev/null +++ b/lib/common/fuzz/certificate/exportable.svg @@ -0,0 +1,115 @@ + + + + + + +gocallvis + + +cluster_focus + +exportable + + +cluster_github.com/go-i2p/go-i2p/lib/common/certificate + + +certificate + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate + + +(*Certificate) + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/certificate.Fuzz + + +Fuzz + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate + + +ReadCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/certificate.Fuzz->github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + +Data + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/certificate.Fuzz->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + +Length + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/certificate.Fuzz->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + +Type + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/certificate.Fuzz->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + diff --git a/lib/common/fuzz/destination/doc.md b/lib/common/fuzz/destination/doc.md index 5b01e3e..29024f4 100644 --- a/lib/common/fuzz/destination/doc.md +++ b/lib/common/fuzz/destination/doc.md @@ -10,3 +10,25 @@ ```go func Fuzz(data []byte) int ``` + +# exportable +-- + import "github.com/go-i2p/go-i2p/lib/common/fuzz/destination" + + + +![exportable.svg](exportable) + +## Usage + +#### func Fuzz + +```go +func Fuzz(data []byte) int +``` + + + +exportable + +github.com/go-i2p/go-i2p/lib/common/fuzz/destination diff --git a/lib/common/fuzz/destination/exportable.svg b/lib/common/fuzz/destination/exportable.svg new file mode 100644 index 0000000..c076b14 --- /dev/null +++ b/lib/common/fuzz/destination/exportable.svg @@ -0,0 +1,97 @@ + + + + + + +gocallvis + + +cluster_focus + +exportable + + +cluster_github.com/go-i2p/go-i2p/lib/common/destination + + +destination + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/destination.Destination + + +(Destination) + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/destination.Fuzz + + +Fuzz + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination + + +ReadDestination + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/destination.Fuzz->github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address + + +Base32Address + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/destination.Fuzz->(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base32Address + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64 + + +Base64 + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/destination.Fuzz->(github.com/go-i2p/go-i2p/lib/common/destination.Destination).Base64 + + + + + + + + diff --git a/lib/common/fuzz/keys_and_cert/doc.md b/lib/common/fuzz/keys_and_cert/doc.md index bc92c71..fb4db6e 100644 --- a/lib/common/fuzz/keys_and_cert/doc.md +++ b/lib/common/fuzz/keys_and_cert/doc.md @@ -10,3 +10,25 @@ ```go func Fuzz(data []byte) int ``` + +# exportable +-- + import "github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert" + + + +![exportable.svg](exportable) + +## Usage + +#### func Fuzz + +```go +func Fuzz(data []byte) int +``` + + + +exportable + +github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert diff --git a/lib/common/fuzz/keys_and_cert/exportable.svg b/lib/common/fuzz/keys_and_cert/exportable.svg new file mode 100644 index 0000000..64e4f1d --- /dev/null +++ b/lib/common/fuzz/keys_and_cert/exportable.svg @@ -0,0 +1,115 @@ + + + + + + +gocallvis + + +cluster_focus + +exportable + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert + + +keys_and_cert + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(*KeysAndCert) + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert.Fuzz + + +Fuzz + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + +ReadKeysAndCert + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert.Fuzz->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + +Certificate + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert.Fuzz->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).PublicKey + + +PublicKey + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert.Fuzz->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).PublicKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).SigningPublicKey + + +SigningPublicKey + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/keys_and_cert.Fuzz->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).SigningPublicKey + + + + + + + + diff --git a/lib/common/fuzz/router_address/doc.md b/lib/common/fuzz/router_address/doc.md index a221b33..5c1ad29 100644 --- a/lib/common/fuzz/router_address/doc.md +++ b/lib/common/fuzz/router_address/doc.md @@ -10,3 +10,25 @@ ```go func Fuzz(data []byte) int ``` + +# exportable +-- + import "github.com/go-i2p/go-i2p/lib/common/fuzz/router_address" + + + +![exportable.svg](exportable) + +## Usage + +#### func Fuzz + +```go +func Fuzz(data []byte) int +``` + + + +exportable + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_address diff --git a/lib/common/fuzz/router_address/exportable.svg b/lib/common/fuzz/router_address/exportable.svg new file mode 100644 index 0000000..ba85706 --- /dev/null +++ b/lib/common/fuzz/router_address/exportable.svg @@ -0,0 +1,133 @@ + + + + + + +gocallvis + + +cluster_focus + +exportable + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address + + +router_address + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress + + +(RouterAddress) + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_address.Fuzz + + +Fuzz + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress + + +ReadRouterAddress + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_address.Fuzz->github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Cost + + +Cost + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_address.Fuzz->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Cost + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Expiration + + +Expiration + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_address.Fuzz->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Expiration + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Options + + +Options + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_address.Fuzz->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Options + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + +TransportStyle + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_address.Fuzz->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + diff --git a/lib/common/fuzz/router_identity/doc.md b/lib/common/fuzz/router_identity/doc.md index 18208d6..2d085ac 100644 --- a/lib/common/fuzz/router_identity/doc.md +++ b/lib/common/fuzz/router_identity/doc.md @@ -10,3 +10,25 @@ ```go func Fuzz(data []byte) int ``` + +# exportable +-- + import "github.com/go-i2p/go-i2p/lib/common/fuzz/router_identity" + + + +![exportable.svg](exportable) + +## Usage + +#### func Fuzz + +```go +func Fuzz(data []byte) int +``` + + + +exportable + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_identity diff --git a/lib/common/fuzz/router_identity/exportable.svg b/lib/common/fuzz/router_identity/exportable.svg new file mode 100644 index 0000000..69aa06a --- /dev/null +++ b/lib/common/fuzz/router_identity/exportable.svg @@ -0,0 +1,87 @@ + + + + + + +gocallvis + + +cluster_focus + +exportable + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_identity + + +router_identity + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert + + +keys_and_cert + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(*KeysAndCert) + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_identity.Fuzz + + +Fuzz + + + + + +(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + +Certificate + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_identity.Fuzz->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity + + +ReadRouterIdentity + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/router_identity.Fuzz->github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity + + + + + + + + diff --git a/lib/common/fuzz/string/doc.md b/lib/common/fuzz/string/doc.md index c432f87..988905f 100644 --- a/lib/common/fuzz/string/doc.md +++ b/lib/common/fuzz/string/doc.md @@ -10,3 +10,25 @@ ```go func Fuzz(data []byte) int ``` + +# exportable +-- + import "github.com/go-i2p/go-i2p/lib/common/fuzz/string" + + + +![exportable.svg](exportable) + +## Usage + +#### func Fuzz + +```go +func Fuzz(data []byte) int +``` + + + +exportable + +github.com/go-i2p/go-i2p/lib/common/fuzz/string diff --git a/lib/common/fuzz/string/exportable.svg b/lib/common/fuzz/string/exportable.svg new file mode 100644 index 0000000..b9e97dc --- /dev/null +++ b/lib/common/fuzz/string/exportable.svg @@ -0,0 +1,97 @@ + + + + + + +gocallvis + + +cluster_focus + +exportable + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.I2PString + + +(I2PString) + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/string.Fuzz + + +Fuzz + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + +ToI2PString + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/string.Fuzz->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + +Data + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/string.Fuzz->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length + + +Length + + + + + +github.com/go-i2p/go-i2p/lib/common/fuzz/string.Fuzz->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Length + + + + + + + + diff --git a/lib/common/key_certificate/doc.md b/lib/common/key_certificate/doc.md index 6d189a0..9b6c056 100644 --- a/lib/common/key_certificate/doc.md +++ b/lib/common/key_certificate/doc.md @@ -8,26 +8,26 @@ Package key_certificate implements the I2P Destination common data structure ```go const ( - KEYCERT_SIGN_DSA_SHA1 = iota - KEYCERT_SIGN_P256 - KEYCERT_SIGN_P384 - KEYCERT_SIGN_P521 - KEYCERT_SIGN_RSA2048 - KEYCERT_SIGN_RSA3072 - KEYCERT_SIGN_RSA4096 - KEYCERT_SIGN_ED25519 - KEYCERT_SIGN_ED25519PH + KEYCERT_SIGN_DSA_SHA1 = 0 + KEYCERT_SIGN_P256 = 1 + KEYCERT_SIGN_P384 = 2 + KEYCERT_SIGN_P521 = 3 + KEYCERT_SIGN_RSA2048 = 4 + KEYCERT_SIGN_RSA3072 = 5 + KEYCERT_SIGN_RSA4096 = 6 + KEYCERT_SIGN_ED25519 = 7 + KEYCERT_SIGN_ED25519PH = 8 ) ``` Key Certificate Signing Key Types ```go const ( - KEYCERT_CRYPTO_ELG = iota - KEYCERT_CRYPTO_P256 - KEYCERT_CRYPTO_P384 - KEYCERT_CRYPTO_P521 - KEYCERT_CRYPTO_X25519 + KEYCERT_CRYPTO_ELG = 0 + KEYCERT_CRYPTO_P256 = 1 + KEYCERT_CRYPTO_P384 = 2 + KEYCERT_CRYPTO_P521 = 3 + KEYCERT_CRYPTO_X25519 = 4 ) ``` Key Certificate Public Key Types @@ -45,7 +45,7 @@ const ( KEYCERT_SIGN_ED25519PH_SIZE = 32 ) ``` -SigningPublicKey sizes for Signing Key Types +signingPublicKey sizes for Signing Key Types ```go const ( @@ -56,7 +56,7 @@ const ( KEYCERT_CRYPTO_X25519_SIZE = 32 ) ``` -PublicKey sizes for Public Key Types +publicKey sizes for Public Key Types ```go const ( @@ -66,17 +66,42 @@ const ( ``` Sizes of structures in KeyCertificates +```go +const ( + CRYPTO_KEY_TYPE_ELGAMAL = 0 // ElGamal + + // Signature Types + SIGNATURE_TYPE_DSA_SHA1 = 0 // DSA-SHA1 + SIGNATURE_TYPE_ED25519_SHA512 = 7 // Ed25519 +) +``` + ```go const ( KEYCERT_MIN_SIZE = 7 ) ``` +```go +var CryptoPublicKeySizes = map[uint16]int{ + CRYPTO_KEY_TYPE_ELGAMAL: 256, +} +``` + +```go +var SignaturePublicKeySizes = map[uint16]int{ + SIGNATURE_TYPE_DSA_SHA1: 128, + SIGNATURE_TYPE_ED25519_SHA512: 32, +} +``` + #### type KeyCertificate ```go type KeyCertificate struct { Certificate + SpkType Integer + CpkType Integer } ``` @@ -85,9 +110,8 @@ type KeyCertificate []byte #### func KeyCertificateFromCertificate ```go -func KeyCertificateFromCertificate(certificate Certificate) *KeyCertificate +func KeyCertificateFromCertificate(cert Certificate) (*KeyCertificate, error) ``` -KeyCertificateFromCertificate returns a *KeyCertificate from a *Certificate. #### func NewKeyCertificate @@ -101,54 +125,265 @@ returned. Returns a list of errors that occurred during parsing. #### func (KeyCertificate) ConstructPublicKey ```go -func (key_certificate KeyCertificate) ConstructPublicKey(data []byte) (public_key crypto.PublicKey, err error) +func (keyCertificate KeyCertificate) ConstructPublicKey(data []byte) (public_key crypto.RecievingPublicKey, err error) ``` -ConstructPublicKey returns a PublicKey constructed using any excess data that +ConstructPublicKey returns a publicKey constructed using any excess data that may be stored in the KeyCertififcate. Returns enr errors encountered while parsing. #### func (KeyCertificate) ConstructSigningPublicKey ```go -func (key_certificate KeyCertificate) ConstructSigningPublicKey(data []byte) (signing_public_key crypto.SigningPublicKey, err error) +func (keyCertificate KeyCertificate) ConstructSigningPublicKey(data []byte) (signing_public_key crypto.SigningPublicKey, err error) ``` ConstructSigningPublicKey returns a SingingPublicKey constructed using any excess data that may be stored in the KeyCertificate. Returns any errors encountered while parsing. +#### func (*KeyCertificate) CryptoPublicKeySize + +```go +func (keyCertificate *KeyCertificate) CryptoPublicKeySize() (int, error) +``` + #### func (KeyCertificate) CryptoSize ```go -func (key_certificate KeyCertificate) CryptoSize() (size int) +func (keyCertificate KeyCertificate) CryptoSize() (size int) ``` CryptoSize return the size of a Public Key corresponding to the Key -Certificate's PublicKey type. +Certificate's publicKey type. #### func (KeyCertificate) Data ```go -func (key_certificate KeyCertificate) Data() ([]byte, error) +func (keyCertificate KeyCertificate) Data() ([]byte, error) ``` Data returns the raw []byte contained in the Certificate. #### func (KeyCertificate) PublicKeyType ```go -func (key_certificate KeyCertificate) PublicKeyType() (pubkey_type int) +func (keyCertificate KeyCertificate) PublicKeyType() (pubkey_type int) ``` -PublicKeyType returns the PublicKey type as a Go integer. +PublicKeyType returns the publicKey type as a Go integer. #### func (KeyCertificate) SignatureSize ```go -func (key_certificate KeyCertificate) SignatureSize() (size int) +func (keyCertificate KeyCertificate) SignatureSize() (size int) ``` SignatureSize return the size of a Signature corresponding to the Key -Certificate's SigningPublicKey type. +Certificate's signingPublicKey type. + +#### func (*KeyCertificate) SigningPublicKeySize + +```go +func (keyCertificate *KeyCertificate) SigningPublicKeySize() int +``` #### func (KeyCertificate) SigningPublicKeyType ```go -func (key_certificate KeyCertificate) SigningPublicKeyType() (signing_pubkey_type int) +func (keyCertificate KeyCertificate) SigningPublicKeyType() (signing_pubkey_type int) ``` -SigningPublicKeyType returns the SigningPublicKey type as a Go integer. +SigningPublicKeyType returns the signingPublicKey type as a Go integer. + +# key_certificate +-- + import "github.com/go-i2p/go-i2p/lib/common/key_certificate" + +Package key_certificate implements the I2P Destination common data structure + +![key_certificate.svg](key_certificate) + +## Usage + +```go +const ( + KEYCERT_SIGN_DSA_SHA1 = 0 + KEYCERT_SIGN_P256 = 1 + KEYCERT_SIGN_P384 = 2 + KEYCERT_SIGN_P521 = 3 + KEYCERT_SIGN_RSA2048 = 4 + KEYCERT_SIGN_RSA3072 = 5 + KEYCERT_SIGN_RSA4096 = 6 + KEYCERT_SIGN_ED25519 = 7 + KEYCERT_SIGN_ED25519PH = 8 +) +``` +Key Certificate Signing Key Types + +```go +const ( + KEYCERT_CRYPTO_ELG = 0 + KEYCERT_CRYPTO_P256 = 1 + KEYCERT_CRYPTO_P384 = 2 + KEYCERT_CRYPTO_P521 = 3 + KEYCERT_CRYPTO_X25519 = 4 +) +``` +Key Certificate Public Key Types + +```go +const ( + KEYCERT_SIGN_DSA_SHA1_SIZE = 128 + KEYCERT_SIGN_P256_SIZE = 64 + KEYCERT_SIGN_P384_SIZE = 96 + KEYCERT_SIGN_P521_SIZE = 132 + KEYCERT_SIGN_RSA2048_SIZE = 256 + KEYCERT_SIGN_RSA3072_SIZE = 384 + KEYCERT_SIGN_RSA4096_SIZE = 512 + KEYCERT_SIGN_ED25519_SIZE = 32 + KEYCERT_SIGN_ED25519PH_SIZE = 32 +) +``` +signingPublicKey sizes for Signing Key Types + +```go +const ( + KEYCERT_CRYPTO_ELG_SIZE = 256 + KEYCERT_CRYPTO_P256_SIZE = 64 + KEYCERT_CRYPTO_P384_SIZE = 96 + KEYCERT_CRYPTO_P521_SIZE = 132 + KEYCERT_CRYPTO_X25519_SIZE = 32 +) +``` +publicKey sizes for Public Key Types + +```go +const ( + KEYCERT_PUBKEY_SIZE = 256 + KEYCERT_SPK_SIZE = 128 +) +``` +Sizes of structures in KeyCertificates + +```go +const ( + CRYPTO_KEY_TYPE_ELGAMAL = 0 // ElGamal + + // Signature Types + SIGNATURE_TYPE_DSA_SHA1 = 0 // DSA-SHA1 + SIGNATURE_TYPE_ED25519_SHA512 = 7 // Ed25519 +) +``` + +```go +const ( + KEYCERT_MIN_SIZE = 7 +) +``` + +```go +var CryptoPublicKeySizes = map[uint16]int{ + CRYPTO_KEY_TYPE_ELGAMAL: 256, +} +``` + +```go +var SignaturePublicKeySizes = map[uint16]int{ + SIGNATURE_TYPE_DSA_SHA1: 128, + SIGNATURE_TYPE_ED25519_SHA512: 32, +} +``` + +#### type KeyCertificate + +```go +type KeyCertificate struct { + Certificate + SpkType Integer + CpkType Integer +} +``` + +type KeyCertificate []byte + +#### func KeyCertificateFromCertificate + +```go +func KeyCertificateFromCertificate(cert Certificate) (*KeyCertificate, error) +``` + +#### func NewKeyCertificate + +```go +func NewKeyCertificate(bytes []byte) (key_certificate *KeyCertificate, remainder []byte, err error) +``` +NewKeyCertificate creates a new *KeyCertificate from []byte using +ReadCertificate. The remaining bytes after the specified length are also +returned. Returns a list of errors that occurred during parsing. + +#### func (KeyCertificate) ConstructPublicKey + +```go +func (keyCertificate KeyCertificate) ConstructPublicKey(data []byte) (public_key crypto.RecievingPublicKey, err error) +``` +ConstructPublicKey returns a publicKey constructed using any excess data that +may be stored in the KeyCertififcate. Returns enr errors encountered while +parsing. + +#### func (KeyCertificate) ConstructSigningPublicKey + +```go +func (keyCertificate KeyCertificate) ConstructSigningPublicKey(data []byte) (signing_public_key crypto.SigningPublicKey, err error) +``` +ConstructSigningPublicKey returns a SingingPublicKey constructed using any +excess data that may be stored in the KeyCertificate. Returns any errors +encountered while parsing. + +#### func (*KeyCertificate) CryptoPublicKeySize + +```go +func (keyCertificate *KeyCertificate) CryptoPublicKeySize() (int, error) +``` + +#### func (KeyCertificate) CryptoSize + +```go +func (keyCertificate KeyCertificate) CryptoSize() (size int) +``` +CryptoSize return the size of a Public Key corresponding to the Key +Certificate's publicKey type. + +#### func (KeyCertificate) Data + +```go +func (keyCertificate KeyCertificate) Data() ([]byte, error) +``` +Data returns the raw []byte contained in the Certificate. + +#### func (KeyCertificate) PublicKeyType + +```go +func (keyCertificate KeyCertificate) PublicKeyType() (pubkey_type int) +``` +PublicKeyType returns the publicKey type as a Go integer. + +#### func (KeyCertificate) SignatureSize + +```go +func (keyCertificate KeyCertificate) SignatureSize() (size int) +``` +SignatureSize return the size of a Signature corresponding to the Key +Certificate's signingPublicKey type. + +#### func (*KeyCertificate) SigningPublicKeySize + +```go +func (keyCertificate *KeyCertificate) SigningPublicKeySize() int +``` + +#### func (KeyCertificate) SigningPublicKeyType + +```go +func (keyCertificate KeyCertificate) SigningPublicKeyType() (signing_pubkey_type int) +``` +SigningPublicKeyType returns the signingPublicKey type as a Go integer. + + + +key_certificate + +github.com/go-i2p/go-i2p/lib/common/key_certificate diff --git a/lib/common/key_certificate/key_certificate.svg b/lib/common/key_certificate/key_certificate.svg new file mode 100644 index 0000000..84a83ae --- /dev/null +++ b/lib/common/key_certificate/key_certificate.svg @@ -0,0 +1,790 @@ + + + + + + +gocallvis + + +cluster_focus + +key_certificate + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate + + +(KeyCertificate) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/certificate + + +certificate + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate + + +(*Certificate) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate + + +(*KeyCertificate) + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + +KeyCertificateFromCertificate + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + +Type + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + +Data + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate + + +NewKeyCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate + + +ReadCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadInteger + + +ReadInteger + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->github.com/go-i2p/go-i2p/lib/common/data.ReadInteger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Println + + +Println + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate->(*github.com/sirupsen/logrus.Logger).Println + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeySize + + +SigningPublicKeySize + + + + + +(*github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeySize->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeySize->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoPublicKeySize + + +CryptoPublicKeySize + + + + + +(*github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoPublicKeySize->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoPublicKeySize->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).RawBytes + + +RawBytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType + + +PublicKeyType + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize + + +CryptoSize + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey + + +ConstructSigningPublicKey + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType + + +SigningPublicKeyType + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + +SignatureSize + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).Data + + +Data + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).Data->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).RawBytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).Data->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).Data->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey + + +ConstructPublicKey + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/keys_and_cert/doc.md b/lib/common/keys_and_cert/doc.md index a113c02..f3c2c1b 100644 --- a/lib/common/keys_and_cert/doc.md +++ b/lib/common/keys_and_cert/doc.md @@ -20,7 +20,10 @@ Sizes of various KeysAndCert structures and requirements ```go type KeysAndCert struct { - KeyCertificate *KeyCertificate + KeyCertificate *KeyCertificate + ReceivingPublic crypto.RecievingPublicKey + Padding []byte + SigningPublic crypto.SigningPublicKey } ``` @@ -28,6 +31,20 @@ KeysAndCert is the represenation of an I2P KeysAndCert. https://geti2p.net/spec/common-structures#keysandcert +#### func NewKeysAndCert + +```go +func NewKeysAndCert( + keyCertificate *KeyCertificate, + publicKey crypto.RecievingPublicKey, + padding []byte, + signingPublicKey crypto.SigningPublicKey, +) (*KeysAndCert, error) +``` +NewKeysAndCert creates a new KeysAndCert instance with the provided parameters. +It validates the sizes of the provided keys and padding before assembling the +struct. + #### func ReadKeysAndCert ```go @@ -36,12 +53,18 @@ func ReadKeysAndCert(data []byte) (keys_and_cert KeysAndCert, remainder []byte, ReadKeysAndCert creates a new *KeysAndCert from []byte using ReadKeysAndCert. Returns a pointer to KeysAndCert unlike ReadKeysAndCert. +#### func ReadKeysAndCertElgAndEd25519 + +```go +func ReadKeysAndCertElgAndEd25519(data []byte) (keysAndCert *KeysAndCert, remainder []byte, err error) +``` + #### func (KeysAndCert) Bytes ```go func (keys_and_cert KeysAndCert) Bytes() []byte ``` -Bytes returns the entire KeyCertificate in []byte form, trims payload to +Bytes returns the entire keyCertificate in []byte form, trims payload to specified length. #### func (*KeysAndCert) Certificate @@ -54,13 +77,149 @@ Certfificate returns the certificate. #### func (*KeysAndCert) PublicKey ```go -func (keys_and_cert *KeysAndCert) PublicKey() (key crypto.PublicKey) +func (keys_and_cert *KeysAndCert) PublicKey() (key crypto.RecievingPublicKey) ``` -PublicKey returns the public key as a crypto.PublicKey. +publicKey returns the public key as a crypto.publicKey. #### func (*KeysAndCert) SigningPublicKey ```go func (keys_and_cert *KeysAndCert) SigningPublicKey() (signing_public_key crypto.SigningPublicKey) ``` -SigningPublicKey returns the signing public key. +signingPublicKey returns the signing public key. + +#### type PrivateKeysAndCert + +```go +type PrivateKeysAndCert struct { + KeysAndCert + PK_KEY crypto.PrivateKey + SPK_KEY crypto.PrivateKey +} +``` + +PrivateKeysAndCert contains a KeysAndCert along with the corresponding private +keys for the Public Key and the Signing Public Key + +#### func NewPrivateKeysAndCert + +```go +func NewPrivateKeysAndCert() (*PrivateKeysAndCert, error) +``` + +# keys_and_cert +-- + import "github.com/go-i2p/go-i2p/lib/common/keys_and_cert" + +Package keys_and_cert implements the I2P KeysAndCert common data structure + +![keys_and_cert.svg](keys_and_cert) + +## Usage + +```go +const ( + KEYS_AND_CERT_PUBKEY_SIZE = 256 + KEYS_AND_CERT_SPK_SIZE = 128 + KEYS_AND_CERT_MIN_SIZE = 387 + KEYS_AND_CERT_DATA_SIZE = 384 +) +``` +Sizes of various KeysAndCert structures and requirements + +#### type KeysAndCert + +```go +type KeysAndCert struct { + KeyCertificate *KeyCertificate + ReceivingPublic crypto.RecievingPublicKey + Padding []byte + SigningPublic crypto.SigningPublicKey +} +``` + +KeysAndCert is the represenation of an I2P KeysAndCert. + +https://geti2p.net/spec/common-structures#keysandcert + +#### func NewKeysAndCert + +```go +func NewKeysAndCert( + keyCertificate *KeyCertificate, + publicKey crypto.RecievingPublicKey, + padding []byte, + signingPublicKey crypto.SigningPublicKey, +) (*KeysAndCert, error) +``` +NewKeysAndCert creates a new KeysAndCert instance with the provided parameters. +It validates the sizes of the provided keys and padding before assembling the +struct. + +#### func ReadKeysAndCert + +```go +func ReadKeysAndCert(data []byte) (keys_and_cert KeysAndCert, remainder []byte, err error) +``` +ReadKeysAndCert creates a new *KeysAndCert from []byte using ReadKeysAndCert. +Returns a pointer to KeysAndCert unlike ReadKeysAndCert. + +#### func ReadKeysAndCertElgAndEd25519 + +```go +func ReadKeysAndCertElgAndEd25519(data []byte) (keysAndCert *KeysAndCert, remainder []byte, err error) +``` + +#### func (KeysAndCert) Bytes + +```go +func (keys_and_cert KeysAndCert) Bytes() []byte +``` +Bytes returns the entire keyCertificate in []byte form, trims payload to +specified length. + +#### func (*KeysAndCert) Certificate + +```go +func (keys_and_cert *KeysAndCert) Certificate() (cert Certificate) +``` +Certfificate returns the certificate. + +#### func (*KeysAndCert) PublicKey + +```go +func (keys_and_cert *KeysAndCert) PublicKey() (key crypto.RecievingPublicKey) +``` +publicKey returns the public key as a crypto.publicKey. + +#### func (*KeysAndCert) SigningPublicKey + +```go +func (keys_and_cert *KeysAndCert) SigningPublicKey() (signing_public_key crypto.SigningPublicKey) +``` +signingPublicKey returns the signing public key. + +#### type PrivateKeysAndCert + +```go +type PrivateKeysAndCert struct { + KeysAndCert + PK_KEY crypto.PrivateKey + SPK_KEY crypto.PrivateKey +} +``` + +PrivateKeysAndCert contains a KeysAndCert along with the corresponding private +keys for the Public Key and the Signing Public Key + +#### func NewPrivateKeysAndCert + +```go +func NewPrivateKeysAndCert() (*PrivateKeysAndCert, error) +``` + + + +keys_and_cert + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert diff --git a/lib/common/keys_and_cert/keys_and_cert.svg b/lib/common/keys_and_cert/keys_and_cert.svg new file mode 100644 index 0000000..e73b7f3 --- /dev/null +++ b/lib/common/keys_and_cert/keys_and_cert.svg @@ -0,0 +1,557 @@ + + + + + + +gocallvis + + +cluster_focus + +keys_and_cert + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(KeysAndCert) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate + + +key_certificate + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate + + +(KeyCertificate) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/certificate + + +certificate + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate + + +(*Certificate) + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + +ReadKeysAndCert + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate + + +NewKeyCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize + + +CryptoSize + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + +SignatureSize + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey + + +ConstructPublicKey + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructPublicKey + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey + + +ConstructSigningPublicKey + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType + + +PublicKeyType + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType + + +SigningPublicKeyType + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert + + +NewKeysAndCert + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.constructSigningPublicKey + + +constructSigningPublicKey + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.constructSigningPublicKey->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.constructPublicKey + + +constructPublicKey + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.constructPublicKey->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519 + + +ReadKeysAndCertElgAndEd25519 + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519->github.com/go-i2p/go-i2p/lib/common/key_certificate.NewKeyCertificate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/lease/doc.md b/lib/common/lease/doc.md index ec9e6cd..b2876f4 100644 --- a/lib/common/lease/doc.md +++ b/lib/common/lease/doc.md @@ -21,17 +21,21 @@ Sizes in bytes of various components of a Lease type Lease [LEASE_SIZE]byte ``` -Lease is the represenation of an I2P Lease. - -https://geti2p.net/spec/common-structures#lease #### func NewLease ```go -func NewLease(data []byte) (lease *Lease, remainder []byte, err error) +func NewLease(tunnelGateway Hash, tunnelID uint32, expirationTime time.Time) (*Lease, error) ``` -NewLease creates a new *NewLease from []byte using ReadLease. Returns a pointer -to KeysAndCert unlike ReadLease. +NewLease creates a new Lease with the provided parameters. + +#### func NewLeaseFromBytes + +```go +func NewLeaseFromBytes(data []byte) (lease *Lease, remainder []byte, err error) +``` +NewLeaseFromBytes creates a new *Lease from []byte using ReadLease. Returns a +pointer to Lease unlike ReadLease. #### func ReadLease @@ -61,3 +65,79 @@ TunnelGateway returns the tunnel gateway as a Hash. func (lease Lease) TunnelID() uint32 ``` TunnelID returns the tunnel id as a uint23. + +# lease +-- + import "github.com/go-i2p/go-i2p/lib/common/lease" + +Package lease implements the I2P lease common data structure + +![lease.svg](lease) + +## Usage + +```go +const ( + LEASE_SIZE = 44 + LEASE_TUNNEL_GW_SIZE = 32 + LEASE_TUNNEL_ID_SIZE = 4 +) +``` +Sizes in bytes of various components of a Lease + +#### type Lease + +```go +type Lease [LEASE_SIZE]byte +``` + + +#### func NewLease + +```go +func NewLease(tunnelGateway Hash, tunnelID uint32, expirationTime time.Time) (*Lease, error) +``` +NewLease creates a new Lease with the provided parameters. + +#### func NewLeaseFromBytes + +```go +func NewLeaseFromBytes(data []byte) (lease *Lease, remainder []byte, err error) +``` +NewLeaseFromBytes creates a new *Lease from []byte using ReadLease. Returns a +pointer to Lease unlike ReadLease. + +#### func ReadLease + +```go +func ReadLease(data []byte) (lease Lease, remainder []byte, err error) +``` +ReadLease returns Lease from a []byte. The remaining bytes after the specified +length are also returned. Returns a list of errors that occurred during parsing. + +#### func (Lease) Date + +```go +func (lease Lease) Date() (date Date) +``` +Date returns the date as an I2P Date. + +#### func (Lease) TunnelGateway + +```go +func (lease Lease) TunnelGateway() (hash Hash) +``` +TunnelGateway returns the tunnel gateway as a Hash. + +#### func (Lease) TunnelID + +```go +func (lease Lease) TunnelID() uint32 +``` +TunnelID returns the tunnel id as a uint23. + + + +lease + +github.com/go-i2p/go-i2p/lib/common/lease diff --git a/lib/common/lease/lease.svg b/lib/common/lease/lease.svg new file mode 100644 index 0000000..a45b534 --- /dev/null +++ b/lib/common/lease/lease.svg @@ -0,0 +1,414 @@ + + + + + + +gocallvis + + +cluster_focus + +lease + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/lease.Lease + + +(Lease) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Date + + +(Date) + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLease + + +NewLease + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLease->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLease->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes + + +NewLeaseFromBytes + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease + + +ReadLease + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->github.com/go-i2p/go-i2p/lib/common/lease.ReadLease + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + +Time + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease.Lease).TunnelID + + +TunnelID + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(github.com/go-i2p/go-i2p/lib/common/lease.Lease).TunnelID + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease.Lease).Date + + +Date + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(github.com/go-i2p/go-i2p/lib/common/lease.Lease).Date + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.NewLeaseFromBytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->(github.com/go-i2p/go-i2p/lib/common/lease.Lease).TunnelID + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->(github.com/go-i2p/go-i2p/lib/common/lease.Lease).Date + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease.ReadLease->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease.Lease).TunnelID->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + diff --git a/lib/common/lease_set/doc.md b/lib/common/lease_set/doc.md index 6fa5410..241a9f8 100644 --- a/lib/common/lease_set/doc.md +++ b/lib/common/lease_set/doc.md @@ -15,6 +15,12 @@ const ( ``` Sizes of various structures in an I2P LeaseSet +#### func ReadDestinationFromLeaseSet + +```go +func ReadDestinationFromLeaseSet(data []byte) (destination Destination, remainder []byte, err error) +``` + #### type LeaseSet ```go @@ -25,6 +31,18 @@ LeaseSet is the represenation of an I2P LeaseSet. https://geti2p.net/spec/common-structures#leaseset +#### func NewLeaseSet + +```go +func NewLeaseSet( + destination Destination, + encryptionKey crypto.RecievingPublicKey, + signingKey crypto.SigningPublicKey, + leases []Lease, + signingPrivateKey crypto.SigningPrivateKey, +) (LeaseSet, error) +``` + #### func (LeaseSet) Destination ```go @@ -32,6 +50,12 @@ func (lease_set LeaseSet) Destination() (destination Destination, err error) ``` Destination returns the Destination as []byte. +#### func (LeaseSet) DestinationDeux + +```go +func (lease_set LeaseSet) DestinationDeux() (destination Destination, err error) +``` + #### func (LeaseSet) LeaseCount ```go @@ -74,7 +98,7 @@ encountered during parsing. #### func (LeaseSet) Signature ```go -func (lease_set LeaseSet) Signature() (signature Signature, err error) +func (lease_set LeaseSet) Signature() (signature signature.Signature, err error) ``` Signature returns the signature as Signature. returns errors encountered during parsing. @@ -93,3 +117,131 @@ errors encountered during parsing. func (lease_set LeaseSet) Verify() error ``` Verify returns nil + +# lease_set +-- + import "github.com/go-i2p/go-i2p/lib/common/lease_set" + +Package lease_set implements the I2P LeastSet common data structure + +![lease_set.svg](lease_set) + +## Usage + +```go +const ( + LEASE_SET_PUBKEY_SIZE = 256 + LEASE_SET_SPK_SIZE = 128 + LEASE_SET_SIG_SIZE = 40 +) +``` +Sizes of various structures in an I2P LeaseSet + +#### func ReadDestinationFromLeaseSet + +```go +func ReadDestinationFromLeaseSet(data []byte) (destination Destination, remainder []byte, err error) +``` + +#### type LeaseSet + +```go +type LeaseSet []byte +``` + +LeaseSet is the represenation of an I2P LeaseSet. + +https://geti2p.net/spec/common-structures#leaseset + +#### func NewLeaseSet + +```go +func NewLeaseSet( + destination Destination, + encryptionKey crypto.RecievingPublicKey, + signingKey crypto.SigningPublicKey, + leases []Lease, + signingPrivateKey crypto.SigningPrivateKey, +) (LeaseSet, error) +``` + +#### func (LeaseSet) Destination + +```go +func (lease_set LeaseSet) Destination() (destination Destination, err error) +``` +Destination returns the Destination as []byte. + +#### func (LeaseSet) DestinationDeux + +```go +func (lease_set LeaseSet) DestinationDeux() (destination Destination, err error) +``` + +#### func (LeaseSet) LeaseCount + +```go +func (lease_set LeaseSet) LeaseCount() (count int, err error) +``` +LeaseCount returns the numbert of leases specified by the LeaseCount value as +int. returns errors encountered during parsing. + +#### func (LeaseSet) Leases + +```go +func (lease_set LeaseSet) Leases() (leases []Lease, err error) +``` +Leases returns the leases as []Lease. returns errors encountered during parsing. + +#### func (LeaseSet) NewestExpiration + +```go +func (lease_set LeaseSet) NewestExpiration() (newest Date, err error) +``` +NewestExpiration returns the newest lease expiration as an I2P Date. Returns +errors encountered during parsing. + +#### func (LeaseSet) OldestExpiration + +```go +func (lease_set LeaseSet) OldestExpiration() (earliest Date, err error) +``` +OldestExpiration returns the oldest lease expiration as an I2P Date. Returns +errors encountered during parsing. + +#### func (LeaseSet) PublicKey + +```go +func (lease_set LeaseSet) PublicKey() (public_key crypto.ElgPublicKey, err error) +``` +PublicKey returns the public key as crypto.ElgPublicKey. Returns errors +encountered during parsing. + +#### func (LeaseSet) Signature + +```go +func (lease_set LeaseSet) Signature() (signature signature.Signature, err error) +``` +Signature returns the signature as Signature. returns errors encountered during +parsing. + +#### func (LeaseSet) SigningKey + +```go +func (lease_set LeaseSet) SigningKey() (signing_public_key crypto.SigningPublicKey, err error) +``` +SigningKey returns the signing public key as crypto.SigningPublicKey. returns +errors encountered during parsing. + +#### func (LeaseSet) Verify + +```go +func (lease_set LeaseSet) Verify() error +``` +Verify returns nil + + + +lease_set + +github.com/go-i2p/go-i2p/lib/common/lease_set diff --git a/lib/common/lease_set/lease_set.svg b/lib/common/lease_set/lease_set.svg new file mode 100644 index 0000000..5163da3 --- /dev/null +++ b/lib/common/lease_set/lease_set.svg @@ -0,0 +1,1304 @@ + + + + + + +gocallvis + + +cluster_focus + +lease_set + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet + + +(LeaseSet) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/lease + + +lease + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/lease.Lease + + +(Lease) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert + + +keys_and_cert + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(KeysAndCert) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(*KeysAndCert) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate + + +key_certificate + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate + + +(KeyCertificate) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/destination + + +destination + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Date + + +(Date) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/certificate + + +certificate + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate + + +(*Certificate) + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet + + +NewLeaseSet + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + +Type + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + +NewIntegerFromInt + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + +Bytes + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + +KeyCertificateFromCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + +SignatureSize + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + +Certificate + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + +Bytes + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.NewLeaseSet->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.ReadDestinationFromLeaseSet + + +ReadDestinationFromLeaseSet + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate + + +ReadCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.ReadDestinationFromLeaseSet->github.com/go-i2p/go-i2p/lib/common/certificate.ReadCertificate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.ReadDestinationFromLeaseSet->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + +Length + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.ReadDestinationFromLeaseSet->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + +ReadKeysAndCert + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.ReadDestinationFromLeaseSet->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.ReadDestinationFromLeaseSet->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/lease_set.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + +Time + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination + + +ReadDestination + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey + + +ConstructSigningPublicKey + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519 + + +ReadKeysAndCertElgAndEd25519 + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease.Lease).Date + + +Date + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination + + +Destination + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination->github.com/go-i2p/go-i2p/lib/common/destination.ReadDestination + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCertElgAndEd25519 + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration + + +NewestExpiration + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration->(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration->(github.com/go-i2p/go-i2p/lib/common/lease.Lease).Date + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases + + +Leases + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration->(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).NewestExpiration->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount + + +LeaseCount + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).PublicKey + + +PublicKey + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).PublicKey->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).PublicKey->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).PublicKey->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).PublicKey->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).PublicKey->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature + + +Signature + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).LeaseCount + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Signature->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).DestinationDeux + + +DestinationDeux + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).DestinationDeux->github.com/go-i2p/go-i2p/lib/common/lease_set.ReadDestinationFromLeaseSet + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Verify + + +Verify + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Verify->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Verify->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey + + +SigningKey + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).ConstructSigningPublicKey + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Destination + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).SigningKey->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration + + +OldestExpiration + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration->(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration->(github.com/go-i2p/go-i2p/lib/common/lease.Lease).Date + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration->(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).Leases + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/lease_set.LeaseSet).OldestExpiration->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/router_address/doc.md b/lib/common/router_address/doc.md index 4491417..02bc3ec 100644 --- a/lib/common/router_address/doc.md +++ b/lib/common/router_address/doc.md @@ -28,6 +28,14 @@ RouterAddress is the represenation of an I2P RouterAddress. https://geti2p.net/spec/common-structures#routeraddress +#### func NewRouterAddress + +```go +func NewRouterAddress(cost uint8, expiration time.Time, transportType string, options map[string]string) (*RouterAddress, error) +``` +NewRouterAddress creates a new RouterAddress with the provided parameters. +Returns a pointer to RouterAddress. + #### func ReadRouterAddress ```go @@ -44,6 +52,12 @@ func (router_address RouterAddress) Bytes() []byte ``` Bytes returns the router address as a []byte. +#### func (RouterAddress) CapsString + +```go +func (router_address RouterAddress) CapsString() I2PString +``` + #### func (RouterAddress) Cost ```go @@ -77,10 +91,17 @@ func (router_address RouterAddress) Host() (net.Addr, error) func (router_address RouterAddress) HostString() I2PString ``` +#### func (*RouterAddress) IPVersion + +```go +func (router_address *RouterAddress) IPVersion() string +``` +IPVersion returns a string "4" for IPv4 or 6 for IPv6 + #### func (RouterAddress) InitializationVector ```go -func (router_address RouterAddress) InitializationVector() ([32]byte, error) +func (router_address RouterAddress) InitializationVector() ([16]byte, error) ``` #### func (RouterAddress) InitializationVectorString @@ -112,7 +133,7 @@ func (router_address RouterAddress) IntroducerTagString(num int) I2PString ```go func (router_address *RouterAddress) Network() string ``` -Network implements net.Addr. It returns the transport type +Network implements net.Addr. It returns the transport type plus 4 or 6 #### func (RouterAddress) Options @@ -177,3 +198,212 @@ I2PString. ```go func (router_address *RouterAddress) UDP() bool ``` + +# router_address +-- + import "github.com/go-i2p/go-i2p/lib/common/router_address" + +Package router_address implements the I2P RouterAddress common data structure + +![router_address.svg](router_address) + +## Usage + +```go +const ( + ROUTER_ADDRESS_MIN_SIZE = 9 +) +``` +Minimum number of bytes in a valid RouterAddress + +#### type RouterAddress + +```go +type RouterAddress struct { + TransportCost *Integer + ExpirationDate *Date + TransportType I2PString + TransportOptions *Mapping +} +``` + +RouterAddress is the represenation of an I2P RouterAddress. + +https://geti2p.net/spec/common-structures#routeraddress + +#### func NewRouterAddress + +```go +func NewRouterAddress(cost uint8, expiration time.Time, transportType string, options map[string]string) (*RouterAddress, error) +``` +NewRouterAddress creates a new RouterAddress with the provided parameters. +Returns a pointer to RouterAddress. + +#### func ReadRouterAddress + +```go +func ReadRouterAddress(data []byte) (router_address RouterAddress, remainder []byte, err error) +``` +ReadRouterAddress returns RouterAddress from a []byte. The remaining bytes after +the specified length are also returned. Returns a list of errors that occurred +during parsing. + +#### func (RouterAddress) Bytes + +```go +func (router_address RouterAddress) Bytes() []byte +``` +Bytes returns the router address as a []byte. + +#### func (RouterAddress) CapsString + +```go +func (router_address RouterAddress) CapsString() I2PString +``` + +#### func (RouterAddress) Cost + +```go +func (router_address RouterAddress) Cost() int +``` +Cost returns the cost for this RouterAddress as a Go integer. + +#### func (RouterAddress) Expiration + +```go +func (router_address RouterAddress) Expiration() Date +``` +Expiration returns the expiration for this RouterAddress as an I2P Date. + +#### func (RouterAddress) GetOption + +```go +func (router_address RouterAddress) GetOption(key I2PString) I2PString +``` +GetOption returns the value of the option specified by the key + +#### func (RouterAddress) Host + +```go +func (router_address RouterAddress) Host() (net.Addr, error) +``` + +#### func (RouterAddress) HostString + +```go +func (router_address RouterAddress) HostString() I2PString +``` + +#### func (*RouterAddress) IPVersion + +```go +func (router_address *RouterAddress) IPVersion() string +``` +IPVersion returns a string "4" for IPv4 or 6 for IPv6 + +#### func (RouterAddress) InitializationVector + +```go +func (router_address RouterAddress) InitializationVector() ([16]byte, error) +``` + +#### func (RouterAddress) InitializationVectorString + +```go +func (router_address RouterAddress) InitializationVectorString() I2PString +``` + +#### func (RouterAddress) IntroducerExpirationString + +```go +func (router_address RouterAddress) IntroducerExpirationString(num int) I2PString +``` + +#### func (RouterAddress) IntroducerHashString + +```go +func (router_address RouterAddress) IntroducerHashString(num int) I2PString +``` + +#### func (RouterAddress) IntroducerTagString + +```go +func (router_address RouterAddress) IntroducerTagString(num int) I2PString +``` + +#### func (*RouterAddress) Network + +```go +func (router_address *RouterAddress) Network() string +``` +Network implements net.Addr. It returns the transport type plus 4 or 6 + +#### func (RouterAddress) Options + +```go +func (router_address RouterAddress) Options() Mapping +``` +Options returns the options for this RouterAddress as an I2P Mapping. + +#### func (RouterAddress) Port + +```go +func (router_address RouterAddress) Port() (string, error) +``` + +#### func (RouterAddress) PortString + +```go +func (router_address RouterAddress) PortString() I2PString +``` + +#### func (RouterAddress) ProtocolVersion + +```go +func (router_address RouterAddress) ProtocolVersion() (string, error) +``` + +#### func (RouterAddress) ProtocolVersionString + +```go +func (router_address RouterAddress) ProtocolVersionString() I2PString +``` + +#### func (RouterAddress) StaticKey + +```go +func (router_address RouterAddress) StaticKey() ([32]byte, error) +``` + +#### func (RouterAddress) StaticKeyString + +```go +func (router_address RouterAddress) StaticKeyString() I2PString +``` + +#### func (*RouterAddress) String + +```go +func (router_address *RouterAddress) String() string +``` +String implements net.Addr. It returns the IP address, followed by the options + +#### func (RouterAddress) TransportStyle + +```go +func (router_address RouterAddress) TransportStyle() I2PString +``` +TransportStyle returns the transport style for this RouterAddress as an +I2PString. + +#### func (*RouterAddress) UDP + +```go +func (router_address *RouterAddress) UDP() bool +``` + + + +router_address + +github.com/go-i2p/go-i2p/lib/common/router_address diff --git a/lib/common/router_address/router_address.svg b/lib/common/router_address/router_address.svg new file mode 100644 index 0000000..cb073c4 --- /dev/null +++ b/lib/common/router_address/router_address.svg @@ -0,0 +1,1390 @@ + + + + + + +gocallvis + + +cluster_focus + +router_address + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress + + +(RouterAddress) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.MappingValues + + +(MappingValues) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Mapping + + +(Mapping) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.I2PString + + +(I2PString) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Date + + +(Date) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/data.Mapping + + +(*Mapping) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress + + +(*RouterAddress) + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress + + +NewRouterAddress + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + +ToI2PString + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + +NewIntegerFromInt + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate + + +NewDate + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.NewDate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping + + +GoMapToMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress + + +ReadRouterAddress + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.NewDate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + +NewInteger + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString + + +ReadI2PString + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.ReadI2PString + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewMapping + + +NewMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->github.com/go-i2p/go-i2p/lib/common/data.NewMapping + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String + + +String + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).UDP + + +UDP + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).UDP + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVectorString + + +InitializationVectorString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVectorString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKeyString + + +StaticKeyString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKeyString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).HostString + + +HostString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).HostString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerExpirationString + + +IntroducerExpirationString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerExpirationString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).PortString + + +PortString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).PortString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + +TransportStyle + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersionString + + +ProtocolVersionString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersionString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerHashString + + +IntroducerHashString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerHashString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerTagString + + +IntroducerTagString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerTagString + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network + + +Network + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).UDP->(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).UDP->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).UDP->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IPVersion + + +IPVersion + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network->(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IPVersion + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + +Data + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Network->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IPVersion->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).CapsString + + +CapsString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IPVersion->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).CapsString + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IPVersion->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IPVersion->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IPVersion->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data + + +Data + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + +Values + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get + + +Get + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVectorString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + +GetOption + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVectorString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption->(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption->(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Options + + +Options + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Options + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKeyString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKeyString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey + + +StaticKey + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKeyString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host + + +Host + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).HostString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Host->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).HostString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).HostString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerExpirationString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerExpirationString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).PortString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).PortString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes->(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes->(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersionString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersionString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).CapsString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).CapsString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerHashString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerHashString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerTagString->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).IntroducerTagString->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).GetOption + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Port + + +Port + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Port->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Port->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).PortString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Port->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Port->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Port->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Port->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector + + +InitializationVector + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVectorString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Cost + + +Cost + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Cost->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersion + + +ProtocolVersion + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersion->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersion->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).ProtocolVersionString + + + + + + + + diff --git a/lib/common/router_identity/doc.md b/lib/common/router_identity/doc.md index 37b2643..de2c9e3 100644 --- a/lib/common/router_identity/doc.md +++ b/lib/common/router_identity/doc.md @@ -18,6 +18,12 @@ RouterIdentity is the represenation of an I2P RouterIdentity. https://geti2p.net/spec/common-structures#routeridentity +#### func NewRouterIdentity + +```go +func NewRouterIdentity(publicKey crypto.RecievingPublicKey, signingPublicKey crypto.SigningPublicKey, cert certificate.Certificate, padding []byte) (*RouterIdentity, error) +``` + #### func ReadRouterIdentity ```go @@ -26,3 +32,58 @@ func ReadRouterIdentity(data []byte) (router_identity RouterIdentity, remainder ReadRouterIdentity returns RouterIdentity from a []byte. The remaining bytes after the specified length are also returned. Returns a list of errors that occurred during parsing. + +#### func (*RouterIdentity) AsDestination + +```go +func (router_identity *RouterIdentity) AsDestination() destination.Destination +``` + +# router_identity +-- + import "github.com/go-i2p/go-i2p/lib/common/router_identity" + +Package router_identity implements the I2P RouterIdentity common data structure + +![router_identity.svg](router_identity) + +## Usage + +#### type RouterIdentity + +```go +type RouterIdentity struct { + KeysAndCert +} +``` + +RouterIdentity is the represenation of an I2P RouterIdentity. + +https://geti2p.net/spec/common-structures#routeridentity + +#### func NewRouterIdentity + +```go +func NewRouterIdentity(publicKey crypto.RecievingPublicKey, signingPublicKey crypto.SigningPublicKey, cert certificate.Certificate, padding []byte) (*RouterIdentity, error) +``` + +#### func ReadRouterIdentity + +```go +func ReadRouterIdentity(data []byte) (router_identity RouterIdentity, remainder []byte, err error) +``` +ReadRouterIdentity returns RouterIdentity from a []byte. The remaining bytes +after the specified length are also returned. Returns a list of errors that +occurred during parsing. + +#### func (*RouterIdentity) AsDestination + +```go +func (router_identity *RouterIdentity) AsDestination() destination.Destination +``` + + + +router_identity + +github.com/go-i2p/go-i2p/lib/common/router_identity diff --git a/lib/common/router_identity/router_identity.svg b/lib/common/router_identity/router_identity.svg new file mode 100644 index 0000000..ccc78b2 --- /dev/null +++ b/lib/common/router_identity/router_identity.svg @@ -0,0 +1,317 @@ + + + + + + +gocallvis + + +cluster_focus + +router_identity + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert + + +keys_and_cert + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate + + +key_certificate + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate + + +(KeyCertificate) + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity + + +ReadRouterIdentity + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + +ReadKeysAndCert + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.ReadKeysAndCert + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity + + +NewRouterIdentity + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + +KeyCertificateFromCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType + + +PublicKeyType + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).PublicKeyType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType + + +SigningPublicKeyType + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SigningPublicKeyType + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert + + +NewKeysAndCert + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->github.com/go-i2p/go-i2p/lib/common/keys_and_cert.NewKeysAndCert + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/router_info/doc.md b/lib/common/router_info/doc.md index d9f50ad..f5e85f8 100644 --- a/lib/common/router_info/doc.md +++ b/lib/common/router_info/doc.md @@ -28,6 +28,25 @@ RouterInfo is the represenation of an I2P RouterInfo. https://geti2p.net/spec/common-structures#routerinfo +#### func NewRouterInfo + +```go +func NewRouterInfo( + routerIdentity *RouterIdentity, + publishedTime time.Time, + addresses []*RouterAddress, + options map[string]string, + signingPrivateKey crypto.SigningPrivateKey, + sigType int, +) (*RouterInfo, error) +``` + +#### func OwnedRouterInfo + +```go +func OwnedRouterInfo(keyCertificate key_certificate.KeyCertificate) *RouterInfo +``` + #### func ReadRouterInfo ```go @@ -37,6 +56,12 @@ ReadRouterInfo returns RouterInfo from a []byte. The remaining bytes after the specified length are also returned. Returns a list of errors that occurred during parsing. +#### func (*RouterInfo) AddAddress + +```go +func (router_info *RouterInfo) AddAddress(address *RouterAddress) +``` + #### func (RouterInfo) Bytes ```go @@ -57,6 +82,13 @@ func (router_info *RouterInfo) IdentHash() Hash ``` IndentHash returns the identity hash (sha256 sum) for this RouterInfo. +#### func (RouterInfo) Network + +```go +func (router_info RouterInfo) Network() string +``` +Network implements net.Addr + #### func (RouterInfo) Options ```go @@ -137,3 +169,183 @@ func (router_info RouterInfo) String() string ```go func (router_info *RouterInfo) UnCongested() bool ``` + +# router_info +-- + import "github.com/go-i2p/go-i2p/lib/common/router_info" + +Package router_info implements the I2P RouterInfo common data structure + +![router_info.svg](router_info) + +## Usage + +```go +const ( + MIN_GOOD_VERSION = 58 + MAX_GOOD_VERSION = 99 +) +``` + +```go +const ROUTER_INFO_MIN_SIZE = 439 +``` + +#### type RouterInfo + +```go +type RouterInfo struct { +} +``` + +RouterInfo is the represenation of an I2P RouterInfo. + +https://geti2p.net/spec/common-structures#routerinfo + +#### func NewRouterInfo + +```go +func NewRouterInfo( + routerIdentity *RouterIdentity, + publishedTime time.Time, + addresses []*RouterAddress, + options map[string]string, + signingPrivateKey crypto.SigningPrivateKey, + sigType int, +) (*RouterInfo, error) +``` + +#### func OwnedRouterInfo + +```go +func OwnedRouterInfo(keyCertificate key_certificate.KeyCertificate) *RouterInfo +``` + +#### func ReadRouterInfo + +```go +func ReadRouterInfo(bytes []byte) (info RouterInfo, remainder []byte, err error) +``` +ReadRouterInfo returns RouterInfo from a []byte. The remaining bytes after the +specified length are also returned. Returns a list of errors that occurred +during parsing. + +#### func (*RouterInfo) AddAddress + +```go +func (router_info *RouterInfo) AddAddress(address *RouterAddress) +``` + +#### func (RouterInfo) Bytes + +```go +func (router_info RouterInfo) Bytes() (bytes []byte, err error) +``` +Bytes returns the RouterInfo as a []byte suitable for writing to a stream. + +#### func (*RouterInfo) GoodVersion + +```go +func (router_info *RouterInfo) GoodVersion() bool +``` + +#### func (*RouterInfo) IdentHash + +```go +func (router_info *RouterInfo) IdentHash() Hash +``` +IndentHash returns the identity hash (sha256 sum) for this RouterInfo. + +#### func (RouterInfo) Network + +```go +func (router_info RouterInfo) Network() string +``` +Network implements net.Addr + +#### func (RouterInfo) Options + +```go +func (router_info RouterInfo) Options() (mapping Mapping) +``` +Options returns the options for this RouterInfo as an I2P Mapping. + +#### func (*RouterInfo) PeerSize + +```go +func (router_info *RouterInfo) PeerSize() int +``` +PeerSize returns the peer size as a Go integer. + +#### func (*RouterInfo) Published + +```go +func (router_info *RouterInfo) Published() *Date +``` +Published returns the date this RouterInfo was published as an I2P Date. + +#### func (*RouterInfo) Reachable + +```go +func (router_info *RouterInfo) Reachable() bool +``` + +#### func (*RouterInfo) RouterAddressCount + +```go +func (router_info *RouterInfo) RouterAddressCount() int +``` +RouterAddressCount returns the count of RouterAddress in this RouterInfo as a Go +integer. + +#### func (*RouterInfo) RouterAddresses + +```go +func (router_info *RouterInfo) RouterAddresses() []*RouterAddress +``` +RouterAddresses returns all RouterAddresses for this RouterInfo as +[]*RouterAddress. + +#### func (*RouterInfo) RouterCapabilities + +```go +func (router_info *RouterInfo) RouterCapabilities() string +``` + +#### func (*RouterInfo) RouterIdentity + +```go +func (router_info *RouterInfo) RouterIdentity() *RouterIdentity +``` +RouterIdentity returns the router identity as *RouterIdentity. + +#### func (*RouterInfo) RouterVersion + +```go +func (router_info *RouterInfo) RouterVersion() string +``` + +#### func (RouterInfo) Signature + +```go +func (router_info RouterInfo) Signature() (signature Signature) +``` +Signature returns the signature for this RouterInfo as an I2P Signature. + +#### func (RouterInfo) String + +```go +func (router_info RouterInfo) String() string +``` + +#### func (*RouterInfo) UnCongested + +```go +func (router_info *RouterInfo) UnCongested() bool +``` + + + +router_info + +github.com/go-i2p/go-i2p/lib/common/router_info diff --git a/lib/common/router_info/router_info.svg b/lib/common/router_info/router_info.svg new file mode 100644 index 0000000..98679f6 --- /dev/null +++ b/lib/common/router_info/router_info.svg @@ -0,0 +1,1408 @@ + + + + + + +gocallvis + + +cluster_focus + +router_info + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/signature + + +signature + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(RouterInfo) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_identity + + +router_identity + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address + + +router_address + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress + + +(RouterAddress) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress + + +(*RouterAddress) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert + + +keys_and_cert + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(KeysAndCert) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert + + +(*KeysAndCert) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.MappingValues + + +(MappingValues) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Mapping + + +(Mapping) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Date + + +(Date) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/data.Mapping + + +(*Mapping) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/certificate + + +certificate + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate + + +(*Certificate) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(*RouterInfo) + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo + + +ReadRouterInfo + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.GetSignatureTypeFromCertificate + + +GetSignatureTypeFromCertificate + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/go-i2p/go-i2p/lib/common/certificate.GetSignatureTypeFromCertificate + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + +Type + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Type + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + +Length + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Length + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewDate + + +NewDate + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/go-i2p/go-i2p/lib/common/data.NewDate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + +NewInteger + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/go-i2p/go-i2p/lib/common/data.NewInteger + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewMapping + + +NewMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/go-i2p/go-i2p/lib/common/data.NewMapping + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + +Certificate + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress + + +ReadRouterAddress + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/go-i2p/go-i2p/lib/common/router_address.ReadRouterAddress + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity + + +ReadRouterIdentity + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/go-i2p/go-i2p/lib/common/router_identity.ReadRouterIdentity + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature + + +NewSignature + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/go-i2p/go-i2p/lib/common/signature.NewSignature + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo + + +NewRouterInfo + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).serializeWithoutSignature + + +serializeWithoutSignature + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).serializeWithoutSignature + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ReadDate + + +ReadDate + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->github.com/go-i2p/go-i2p/lib/common/data.ReadDate + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + +NewIntegerFromInt + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping + + +GoMapToMapping + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->github.com/go-i2p/go-i2p/lib/common/data.GoMapToMapping + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.ReadSignature + + +ReadSignature + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->github.com/go-i2p/go-i2p/lib/common/signature.ReadSignature + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.bytesToString + + +bytesToString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data + + +Data + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).serializeWithoutSignature->(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + +Bytes + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).serializeWithoutSignature->(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + +Bytes + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).serializeWithoutSignature->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + +Bytes + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).serializeWithoutSignature->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes + + +Bytes + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).serializeWithoutSignature->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).GoodVersion + + +GoodVersion + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion + + +RouterVersion + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).GoodVersion->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).GoodVersion->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).GoodVersion->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).GoodVersion->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + +ToI2PString + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + +Values + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion->(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get + + +Get + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion->(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterVersion->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + +RouterAddresses + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).UnCongested + + +UnCongested + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities + + +RouterCapabilities + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).UnCongested->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).UnCongested->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).UnCongested->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).UnCongested->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities->github.com/go-i2p/go-i2p/lib/common/data.ToI2PString + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities->(github.com/go-i2p/go-i2p/lib/common/data.Mapping).Values + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities->(github.com/go-i2p/go-i2p/lib/common/data.MappingValues).Get + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddressCount + + +RouterAddressCount + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddressCount->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddressCount->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddressCount->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Reachable + + +Reachable + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Reachable->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterCapabilities + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Reachable->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Reachable->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Reachable->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash + + +IdentHash + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterIdentity + + +RouterIdentity + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterIdentity + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + +Data + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash->(*github.com/go-i2p/go-i2p/lib/common/certificate.Certificate).Data + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.HashData + + +HashData + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash->github.com/go-i2p/go-i2p/lib/common/data.HashData + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash->(*github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Certificate + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String + + +String + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes + + +Bytes + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes->(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes->(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).Bytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + +String + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->github.com/go-i2p/go-i2p/lib/common/router_info.bytesToString + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->(*github.com/go-i2p/go-i2p/lib/common/data.Mapping).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->(github.com/go-i2p/go-i2p/lib/common/data.Date).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->(github.com/go-i2p/go-i2p/lib/common/keys_and_cert.KeysAndCert).Bytes + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->(*github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).String + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/common/session_key/doc.md b/lib/common/session_key/doc.md index c5e92ec..f0f34f6 100644 --- a/lib/common/session_key/doc.md +++ b/lib/common/session_key/doc.md @@ -32,3 +32,46 @@ func ReadSessionKey(bytes []byte) (info SessionKey, remainder []byte, err error) ReadSessionKey returns SessionKey from a []byte. The remaining bytes after the specified length are also returned. Returns a list of errors that occurred during parsing. + +# session_key +-- + import "github.com/go-i2p/go-i2p/lib/common/session_key" + +Package session_key implements the I2P SessionKey common data structure + +![session_key.svg](session_key) + +## Usage + +#### type SessionKey + +```go +type SessionKey [32]byte +``` + +SessionKey is the represenation of an I2P SessionKey. + +https://geti2p.net/spec/common-structures#sessionkey + +#### func NewSessionKey + +```go +func NewSessionKey(data []byte) (session_key *SessionKey, remainder []byte, err error) +``` +NewSessionKey creates a new *SessionKey from []byte using ReadSessionKey. +Returns a pointer to SessionKey unlike ReadSessionKey. + +#### func ReadSessionKey + +```go +func ReadSessionKey(bytes []byte) (info SessionKey, remainder []byte, err error) +``` +ReadSessionKey returns SessionKey from a []byte. The remaining bytes after the +specified length are also returned. Returns a list of errors that occurred +during parsing. + + + +session_key + +github.com/go-i2p/go-i2p/lib/common/session_key diff --git a/lib/common/session_key/session_key.svg b/lib/common/session_key/session_key.svg new file mode 100644 index 0000000..cedd578 --- /dev/null +++ b/lib/common/session_key/session_key.svg @@ -0,0 +1,169 @@ + + + + + + +gocallvis + + +cluster_focus + +session_key + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Entry + + +(*Entry) + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.ReadSessionKey + + +ReadSessionKey + + + + + +github.com/sirupsen/logrus.Warn + + +Warn + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.ReadSessionKey->github.com/sirupsen/logrus.Warn + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.NewSessionKey + + +NewSessionKey + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.NewSessionKey->github.com/go-i2p/go-i2p/lib/common/session_key.ReadSessionKey + + + + + + + + +github.com/sirupsen/logrus.WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.NewSessionKey->github.com/sirupsen/logrus.WithField + + + + + + + + +github.com/sirupsen/logrus.WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.NewSessionKey->github.com/sirupsen/logrus.WithError + + + + + + + + +github.com/sirupsen/logrus.Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.NewSessionKey->github.com/sirupsen/logrus.Debug + + + + + + + + +(*github.com/sirupsen/logrus.Entry).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.NewSessionKey->(*github.com/sirupsen/logrus.Entry).Debug + + + + + + + + +(*github.com/sirupsen/logrus.Entry).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/session_key.NewSessionKey->(*github.com/sirupsen/logrus.Entry).Error + + + + + + + + diff --git a/lib/common/session_tag/doc.md b/lib/common/session_tag/doc.md index 03374e6..ce39b4c 100644 --- a/lib/common/session_tag/doc.md +++ b/lib/common/session_tag/doc.md @@ -32,3 +32,46 @@ func ReadSessionTag(bytes []byte) (info SessionTag, remainder []byte, err error) ReadSessionTag returns SessionTag from a []byte. The remaining bytes after the specified length are also returned. Returns a list of errors that occurred during parsing. + +# session_tag +-- + import "github.com/go-i2p/go-i2p/lib/common/session_tag" + +Package session_tag implements the I2P SessionTag common data structure + +![session_tag.svg](session_tag) + +## Usage + +#### type SessionTag + +```go +type SessionTag [32]byte +``` + +SessionTag is the represenation of an I2P SessionTag. + +https://geti2p.net/spec/common-structures#session-tag + +#### func NewSessionTag + +```go +func NewSessionTag(data []byte) (session_tag *SessionTag, remainder []byte, err error) +``` +NewSessionTag creates a new *SessionTag from []byte using ReadSessionTag. +Returns a pointer to SessionTag unlike ReadSessionTag. + +#### func ReadSessionTag + +```go +func ReadSessionTag(bytes []byte) (info SessionTag, remainder []byte, err error) +``` +ReadSessionTag returns SessionTag from a []byte. The remaining bytes after the +specified length are also returned. Returns a list of errors that occurred +during parsing. + + + +session_tag + +github.com/go-i2p/go-i2p/lib/common/session_tag diff --git a/lib/common/session_tag/session_tag.svg b/lib/common/session_tag/session_tag.svg new file mode 100644 index 0000000..4e65283 --- /dev/null +++ b/lib/common/session_tag/session_tag.svg @@ -0,0 +1,212 @@ + + + + + + +gocallvis + + +cluster_focus + +session_tag + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.NewSessionTag + + +NewSessionTag + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.ReadSessionTag + + +ReadSessionTag + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.NewSessionTag->github.com/go-i2p/go-i2p/lib/common/session_tag.ReadSessionTag + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.NewSessionTag->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.NewSessionTag->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.NewSessionTag->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.NewSessionTag->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.NewSessionTag->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.ReadSessionTag->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/session_tag.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + diff --git a/lib/common/signature/doc.md b/lib/common/signature/doc.md index c43764d..a004123 100644 --- a/lib/common/signature/doc.md +++ b/lib/common/signature/doc.md @@ -22,6 +22,21 @@ const ( ``` Lengths of signature keys +```go +const ( + SIGNATURE_TYPE_DSA_SHA1 = 0 + SIGNATURE_TYPE_ECDSA_SHA256_P256 = 1 + SIGNATURE_TYPE_ECDSA_SHA384_P384 = 2 + SIGNATURE_TYPE_ECDSA_SHA512_P521 = 3 + SIGNATURE_TYPE_RSA_SHA256_2048 = 4 + SIGNATURE_TYPE_RSA_SHA384_3072 = 5 + SIGNATURE_TYPE_RSA_SHA512_4096 = 6 + SIGNATURE_TYPE_EDDSA_SHA512_ED25519 = 7 + SIGNATURE_TYPE_EDDSA_SHA512_ED25519PH = 8 + SIGNATURE_TYPE_REDDSA_SHA512_ED25519 = 11 +) +``` + #### type Signature ```go @@ -35,7 +50,7 @@ https://geti2p.net/spec/common-structures#signature #### func NewSignature ```go -func NewSignature(data []byte) (session_tag *Signature, remainder []byte, err error) +func NewSignature(data []byte, sigType int) (signature *Signature, remainder []byte, err error) ``` NewSignature creates a new *Signature from []byte using ReadSignature. Returns a pointer to Signature unlike ReadSignature. @@ -43,8 +58,96 @@ pointer to Signature unlike ReadSignature. #### func ReadSignature ```go -func ReadSignature(bytes []byte) (info Signature, remainder []byte, err error) +func ReadSignature(data []byte, sigType int) (sig Signature, remainder []byte, err error) ``` -ReadSignature returns Signature from a []byte. The remaining bytes after the -specified length are also returned. Returns a list of errors that occurred -during parsing. +ReadSignature returns a Signature from a []byte. The remaining bytes after the +specified length are also returned. Returns an error if there is insufficient +data to read the signature. + +Since the signature type and length are inferred from context (the type of key +used), and are not explicitly stated, this function assumes the default +signature type (DSA_SHA1) with a length of 40 bytes. + +If a different signature type is expected based on context, this function should +be modified accordingly to handle the correct signature length. + +# signature +-- + import "github.com/go-i2p/go-i2p/lib/common/signature" + +Package signature implements the I2P Signature common data structure + +![signature.svg](signature) + +## Usage + +```go +const ( + DSA_SHA1_SIZE = 40 + ECDSA_SHA256_P256_SIZE = 64 + ECDSA_SHA384_P384_SIZE = 96 + ECDSA_SHA512_P512_SIZE = 132 + RSA_SHA256_2048_SIZE = 256 + RSA_SHA384_3072_SIZE = 384 + RSA_SHA512_4096_SIZE = 512 + EdDSA_SHA512_Ed25519_SIZE = 64 + EdDSA_SHA512_Ed25519ph_SIZE = 64 + RedDSA_SHA512_Ed25519_SIZE = 64 +) +``` +Lengths of signature keys + +```go +const ( + SIGNATURE_TYPE_DSA_SHA1 = 0 + SIGNATURE_TYPE_ECDSA_SHA256_P256 = 1 + SIGNATURE_TYPE_ECDSA_SHA384_P384 = 2 + SIGNATURE_TYPE_ECDSA_SHA512_P521 = 3 + SIGNATURE_TYPE_RSA_SHA256_2048 = 4 + SIGNATURE_TYPE_RSA_SHA384_3072 = 5 + SIGNATURE_TYPE_RSA_SHA512_4096 = 6 + SIGNATURE_TYPE_EDDSA_SHA512_ED25519 = 7 + SIGNATURE_TYPE_EDDSA_SHA512_ED25519PH = 8 + SIGNATURE_TYPE_REDDSA_SHA512_ED25519 = 11 +) +``` + +#### type Signature + +```go +type Signature []byte +``` + +Signature is the represenation of an I2P Signature. + +https://geti2p.net/spec/common-structures#signature + +#### func NewSignature + +```go +func NewSignature(data []byte, sigType int) (signature *Signature, remainder []byte, err error) +``` +NewSignature creates a new *Signature from []byte using ReadSignature. Returns a +pointer to Signature unlike ReadSignature. + +#### func ReadSignature + +```go +func ReadSignature(data []byte, sigType int) (sig Signature, remainder []byte, err error) +``` +ReadSignature returns a Signature from a []byte. The remaining bytes after the +specified length are also returned. Returns an error if there is insufficient +data to read the signature. + +Since the signature type and length are inferred from context (the type of key +used), and are not explicitly stated, this function assumes the default +signature type (DSA_SHA1) with a length of 40 bytes. + +If a different signature type is expected based on context, this function should +be modified accordingly to handle the correct signature length. + + + +signature + +github.com/go-i2p/go-i2p/lib/common/signature diff --git a/lib/common/signature/signature.svg b/lib/common/signature/signature.svg new file mode 100644 index 0000000..ccae061 --- /dev/null +++ b/lib/common/signature/signature.svg @@ -0,0 +1,238 @@ + + + + + + +gocallvis + + +cluster_focus + +signature + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature + + +NewSignature + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.ReadSignature + + +ReadSignature + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature->github.com/go-i2p/go-i2p/lib/common/signature.ReadSignature + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.NewSignature->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.ReadSignature->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.ReadSignature->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.ReadSignature->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/common/signature.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + diff --git a/lib/config/config.svg b/lib/config/config.svg new file mode 100644 index 0000000..ab1b175 --- /dev/null +++ b/lib/config/config.svg @@ -0,0 +1,498 @@ + + + + + + +gocallvis + + +cluster_focus + +config + + +cluster_gopkg.in/yaml.v3 + + +yaml + + + + +cluster_github.com/spf13/viper + + +viper + + + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig + + +InitConfig + + + + + +github.com/go-i2p/go-i2p/lib/config.setDefaults + + +setDefaults + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/go-i2p/go-i2p/lib/config.setDefaults + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.DefaultRouterConfig + + +DefaultRouterConfig + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/go-i2p/go-i2p/lib/config.DefaultRouterConfig + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.UpdateRouterConfig + + +UpdateRouterConfig + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/go-i2p/go-i2p/lib/config.UpdateRouterConfig + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warnf + + +Warnf + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->(*github.com/go-i2p/logger.Logger).Warnf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Fatalf + + +Fatalf + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->(*github.com/sirupsen/logrus.Logger).Fatalf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debugf + + +Debugf + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->(*github.com/sirupsen/logrus.Logger).Debugf + + + + + + + + +github.com/spf13/viper.SetConfigFile + + +SetConfigFile + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/spf13/viper.SetConfigFile + + + + + + + + +github.com/spf13/viper.ReadInConfig + + +ReadInConfig + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/spf13/viper.ReadInConfig + + + + + + + + +github.com/spf13/viper.AddConfigPath + + +AddConfigPath + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/spf13/viper.AddConfigPath + + + + + + + + +github.com/spf13/viper.SetConfigName + + +SetConfigName + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/spf13/viper.SetConfigName + + + + + + + + +github.com/spf13/viper.SetConfigType + + +SetConfigType + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/spf13/viper.SetConfigType + + + + + + + + +github.com/spf13/viper.ConfigFileUsed + + +ConfigFileUsed + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->github.com/spf13/viper.ConfigFileUsed + + + + + + + + +gopkg.in/yaml.v3.Marshal + + +Marshal + + + + + +github.com/go-i2p/go-i2p/lib/config.InitConfig->gopkg.in/yaml.v3.Marshal + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.setDefaults->github.com/go-i2p/go-i2p/lib/config.DefaultRouterConfig + + + + + + + + +github.com/spf13/viper.SetDefault + + +SetDefault + + + + + +github.com/go-i2p/go-i2p/lib/config.setDefaults->github.com/spf13/viper.SetDefault + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.UpdateRouterConfig->(*github.com/go-i2p/logger.Logger).Warnf + + + + + + + + +github.com/spf13/viper.GetString + + +GetString + + + + + +github.com/go-i2p/go-i2p/lib/config.UpdateRouterConfig->github.com/spf13/viper.GetString + + + + + + + + +github.com/spf13/viper.UnmarshalKey + + +UnmarshalKey + + + + + +github.com/go-i2p/go-i2p/lib/config.UpdateRouterConfig->github.com/spf13/viper.UnmarshalKey + + + + + + + + +github.com/spf13/viper.GetInt + + +GetInt + + + + + +github.com/go-i2p/go-i2p/lib/config.UpdateRouterConfig->github.com/spf13/viper.GetInt + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.defaultConfig + + +defaultConfig + + + + + +github.com/go-i2p/go-i2p/lib/config.home + + +home + + + + + +github.com/go-i2p/go-i2p/lib/config.defaultConfig->github.com/go-i2p/go-i2p/lib/config.home + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.init + + +init + + + + + +github.com/go-i2p/go-i2p/lib/config.init->github.com/go-i2p/go-i2p/lib/config.DefaultRouterConfig + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.init->github.com/go-i2p/go-i2p/lib/config.defaultConfig + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.defaultBase + + +defaultBase + + + + + +github.com/go-i2p/go-i2p/lib/config.init->github.com/go-i2p/go-i2p/lib/config.defaultBase + + + + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/config.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/config.defaultBase->github.com/go-i2p/go-i2p/lib/config.home + + + + + + + + diff --git a/lib/config/doc.md b/lib/config/doc.md index 5608091..db0a2cd 100644 --- a/lib/config/doc.md +++ b/lib/config/doc.md @@ -5,6 +5,16 @@ ## Usage +```go +const GOI2P_BASE_DIR = ".go-i2p" +``` + +```go +var ( + CfgFile string +) +``` + ```go var DefaultBootstrapConfig = BootstrapConfig{ LowPeerThreshold: 10, @@ -25,6 +35,18 @@ default settings for netdb var RouterConfigProperties = DefaultRouterConfig() ``` +#### func InitConfig + +```go +func InitConfig() +``` + +#### func UpdateRouterConfig + +```go +func UpdateRouterConfig() +``` + #### type BootstrapConfig ```go @@ -83,3 +105,120 @@ router.config options ```go func DefaultRouterConfig() *RouterConfig ``` + +# config +-- + import "github.com/go-i2p/go-i2p/lib/config" + + + +![config.svg](config) + +## Usage + +```go +const GOI2P_BASE_DIR = ".go-i2p" +``` + +```go +var ( + CfgFile string +) +``` + +```go +var DefaultBootstrapConfig = BootstrapConfig{ + LowPeerThreshold: 10, + + ReseedServers: []*ReseedConfig{}, +} +``` +default configuration for network bootstrap + +```go +var DefaultNetDbConfig = NetDbConfig{ + Path: filepath.Join(defaultConfig(), "netDb"), +} +``` +default settings for netdb + +```go +var RouterConfigProperties = DefaultRouterConfig() +``` + +#### func InitConfig + +```go +func InitConfig() +``` + +#### func UpdateRouterConfig + +```go +func UpdateRouterConfig() +``` + +#### type BootstrapConfig + +```go +type BootstrapConfig struct { + // if we have less than this many peers we should reseed + LowPeerThreshold int + // reseed servers + ReseedServers []*ReseedConfig +} +``` + + +#### type NetDbConfig + +```go +type NetDbConfig struct { + // path to network database directory + Path string +} +``` + +local network database configuration + +#### type ReseedConfig + +```go +type ReseedConfig struct { + // url of reseed server + Url string + // fingerprint of reseed su3 signing key + SU3Fingerprint string +} +``` + +configuration for 1 reseed server + +#### type RouterConfig + +```go +type RouterConfig struct { + // the path to the base config directory where per-system defaults are stored + BaseDir string + // the path to the working config directory where files are changed + WorkingDir string + // netdb configuration + NetDb *NetDbConfig + // configuration for bootstrapping into the network + Bootstrap *BootstrapConfig +} +``` + +router.config options + +#### func DefaultRouterConfig + +```go +func DefaultRouterConfig() *RouterConfig +``` + + + +config + +github.com/go-i2p/go-i2p/lib/config diff --git a/lib/crypto/crypto.svg b/lib/crypto/crypto.svg new file mode 100644 index 0000000..947c327 --- /dev/null +++ b/lib/crypto/crypto.svg @@ -0,0 +1,13 @@ + + + + + + +gocallvis + + + diff --git a/lib/crypto/doc.md b/lib/crypto/doc.md index 3f7ede8..0c1331a 100644 --- a/lib/crypto/doc.md +++ b/lib/crypto/doc.md @@ -2,7 +2,7 @@ -- import "github.com/go-i2p/go-i2p/lib/crypto" -package for i2p specific cryptography +package for i2p specific crpytography ## Usage @@ -12,89 +12,31 @@ const ( OPAD = byte(0x5C) ) ``` -#### type AESSymmetricKey -```go -type AESSymmetricKey struct { - Key []byte // AES key (must be 16, 24, or 32 bytes for AES-128, AES-192, AES-256) - IV []byte // Initialization Vector (must be 16 bytes for AES) -} -``` -AESSymmetricKey represents a symmetric key for AES encryption/decryption - -#### func (AESSymmetricKey) NewEncrypter - -```go -func (k *AESSymmetricKey) NewEncrypter() (Encrypter, error) -``` -NewEncrypter creates a new AESSymmetricEncrypter - -#### func (AESSymmetricKey) NewDecrypter - -```go -func (k *AESSymmetricKey) NewDecrypter() (Decrypter, error) -``` -NewDecrypter creates a new AESSymmetricDecrypter - -#### func (AESSymmetricKey) Len - -```go -func (k *AESSymmetricKey) Len() int -``` -Len returns the length of the key - -#### type AESSymmetricEncrypter - -```go -type AESSymmetricEncrypter struct { - Key []byte - IV []byte -} -``` - -AESSymmetricEncrypter implements the Encrypter interface using AES - -#### func (*AESSymmetricEncrypter) Encrypt - -```go -func (e *AESSymmetricEncrypter) Encrypt(data []byte) ([]byte, error) -``` -Encrypt encrypts data using AES-CBC with PKCS#7 padding - -#### type AESSymmetricDecrypter - -```go -type AESSymmetricDecrypter struct { - Key []byte - IV []byte -} -``` - -AESSymmetricDecrypter implements the Decrypter interface using AES - -#### func (*AESSymmetricDecrypter) Decrypt - -```go -func (d *AESSymmetricDecrypter) Decrypt(data []byte) ([]byte, error) -``` -Decrypt decrypts data using AES-CBC with PKCS#7 padding ```go var ( - ElgDecryptFail = errors.New("failed to decrypt elgamal encrypted data") - ElgEncryptTooBig = errors.New("failed to encrypt data, too big for elgamal") + Ed25519EncryptTooBig = oops.Errorf("failed to encrypt data, too big for Ed25519") + ErrInvalidPublicKeySize = oops.Errorf("failed to verify: invalid ed25519 public key size") ) ``` ```go var ( - ErrBadSignatureSize = errors.New("bad signature size") - ErrInvalidKeyFormat = errors.New("invalid key format") - ErrInvalidSignature = errors.New("invalid signature") + ElgDecryptFail = oops.Errorf("failed to decrypt elgamal encrypted data") + ElgEncryptTooBig = oops.Errorf("failed to encrypt data, too big for elgamal") ) ``` ```go -var Ed25519EncryptTooBig = errors.New("failed to encrypt data, too big for Ed25519") +var ( + ErrBadSignatureSize = oops.Errorf("bad signature size") + ErrInvalidKeyFormat = oops.Errorf("invalid key format") + ErrInvalidSignature = oops.Errorf("invalid signature") +) +``` + +```go +var Curve25519EncryptTooBig = oops.Errorf("failed to encrypt data, too big for Curve25519") ``` ```go @@ -108,6 +50,180 @@ func ElgamalGenerate(priv *elgamal.PrivateKey, rand io.Reader) (err error) ``` generate an elgamal key pair +#### type AESSymmetricDecrypter + +```go +type AESSymmetricDecrypter struct { + Key []byte + IV []byte +} +``` + +AESSymmetricDecrypter implements the Decrypter interface using AES + +#### func (*AESSymmetricDecrypter) Decrypt + +```go +func (d *AESSymmetricDecrypter) Decrypt(data []byte) ([]byte, error) +``` +Decrypt decrypts data using AES-CBC with PKCS#7 padding + +#### func (*AESSymmetricDecrypter) DecryptNoPadding + +```go +func (d *AESSymmetricDecrypter) DecryptNoPadding(data []byte) ([]byte, error) +``` +DecryptNoPadding decrypts data using AES-CBC without padding + +#### type AESSymmetricEncrypter + +```go +type AESSymmetricEncrypter struct { + Key []byte + IV []byte +} +``` + +AESSymmetricEncrypter implements the Encrypter interface using AES + +#### func (*AESSymmetricEncrypter) Encrypt + +```go +func (e *AESSymmetricEncrypter) Encrypt(data []byte) ([]byte, error) +``` +Encrypt encrypts data using AES-CBC with PKCS#7 padding + +#### func (*AESSymmetricEncrypter) EncryptNoPadding + +```go +func (e *AESSymmetricEncrypter) EncryptNoPadding(data []byte) ([]byte, error) +``` +EncryptNoPadding encrypts data using AES-CBC without padding + +#### type AESSymmetricKey + +```go +type AESSymmetricKey struct { + Key []byte // AES key (must be 16, 24, or 32 bytes for AES-128, AES-192, AES-256) + IV []byte // Initialization Vector (must be 16 bytes for AES) +} +``` + +AESSymmetricKey represents a symmetric key for AES encryption/decryption + +#### func (*AESSymmetricKey) Len + +```go +func (k *AESSymmetricKey) Len() int +``` +Len returns the length of the key + +#### func (*AESSymmetricKey) NewDecrypter + +```go +func (k *AESSymmetricKey) NewDecrypter() (Decrypter, error) +``` +NewDecrypter creates a new AESSymmetricDecrypter + +#### func (*AESSymmetricKey) NewEncrypter + +```go +func (k *AESSymmetricKey) NewEncrypter() (Encrypter, error) +``` +NewEncrypter creates a new AESSymmetricEncrypter + +#### type Curve25519Encryption + +```go +type Curve25519Encryption struct { +} +``` + + +#### func (*Curve25519Encryption) Encrypt + +```go +func (curve25519 *Curve25519Encryption) Encrypt(data []byte) (enc []byte, err error) +``` + +#### func (*Curve25519Encryption) EncryptPadding + +```go +func (curve25519 *Curve25519Encryption) EncryptPadding(data []byte, zeroPadding bool) (encrypted []byte, err error) +``` + +#### type Curve25519PrivateKey + +```go +type Curve25519PrivateKey curve25519.PrivateKey +``` + + +#### type Curve25519PublicKey + +```go +type Curve25519PublicKey []byte +``` + + +#### func (Curve25519PublicKey) Len + +```go +func (k Curve25519PublicKey) Len() int +``` + +#### func (Curve25519PublicKey) NewEncrypter + +```go +func (elg Curve25519PublicKey) NewEncrypter() (enc Encrypter, err error) +``` + +#### func (Curve25519PublicKey) NewVerifier + +```go +func (k Curve25519PublicKey) NewVerifier() (v Verifier, err error) +``` + +#### type Curve25519Signer + +```go +type Curve25519Signer struct { +} +``` + + +#### func (*Curve25519Signer) Sign + +```go +func (s *Curve25519Signer) Sign(data []byte) (sig []byte, err error) +``` + +#### func (*Curve25519Signer) SignHash + +```go +func (s *Curve25519Signer) SignHash(h []byte) (sig []byte, err error) +``` + +#### type Curve25519Verifier + +```go +type Curve25519Verifier struct { +} +``` + + +#### func (*Curve25519Verifier) Verify + +```go +func (v *Curve25519Verifier) Verify(data, sig []byte) (err error) +``` + +#### func (*Curve25519Verifier) VerifyHash + +```go +func (v *Curve25519Verifier) VerifyHash(h, sig []byte) (err error) +``` + #### type DSAPrivateKey ```go @@ -147,6 +263,12 @@ type DSAPublicKey [128]byte ``` +#### func (DSAPublicKey) Bytes + +```go +func (k DSAPublicKey) Bytes() []byte +``` + #### func (DSAPublicKey) Len ```go @@ -251,6 +373,12 @@ type ECP256PublicKey [64]byte ``` +#### func (ECP256PublicKey) Bytes + +```go +func (k ECP256PublicKey) Bytes() []byte +``` + #### func (ECP256PublicKey) Len ```go @@ -277,6 +405,12 @@ type ECP384PublicKey [96]byte ``` +#### func (ECP384PublicKey) Bytes + +```go +func (k ECP384PublicKey) Bytes() []byte +``` + #### func (ECP384PublicKey) Len ```go @@ -303,6 +437,12 @@ type ECP521PublicKey [132]byte ``` +#### func (ECP521PublicKey) Bytes + +```go +func (k ECP521PublicKey) Bytes() []byte +``` + #### func (ECP521PublicKey) Len ```go @@ -315,6 +455,26 @@ func (k ECP521PublicKey) Len() int func (k ECP521PublicKey) NewVerifier() (Verifier, error) ``` +#### type Ed25519Decrypter + +```go +type Ed25519Decrypter struct { +} +``` + + +#### func (*Ed25519Decrypter) Decrypt + +```go +func (d *Ed25519Decrypter) Decrypt(data []byte) ([]byte, error) +``` + +#### func (*Ed25519Decrypter) DecryptPadding + +```go +func (d *Ed25519Decrypter) DecryptPadding(data []byte, zeroPadding bool) ([]byte, error) +``` + #### type Ed25519Encryption ```go @@ -342,6 +502,48 @@ type Ed25519PrivateKey ed25519.PrivateKey ``` +#### func (Ed25519PrivateKey) Bytes + +```go +func (k Ed25519PrivateKey) Bytes() []byte +``` + +#### func (Ed25519PrivateKey) Generate + +```go +func (k Ed25519PrivateKey) Generate() (SigningPrivateKey, error) +``` + +#### func (Ed25519PrivateKey) Len + +```go +func (k Ed25519PrivateKey) Len() int +``` + +#### func (Ed25519PrivateKey) NewDecrypter + +```go +func (k Ed25519PrivateKey) NewDecrypter() (Decrypter, error) +``` + +#### func (Ed25519PrivateKey) NewSigner + +```go +func (k Ed25519PrivateKey) NewSigner() (Signer, error) +``` + +#### func (Ed25519PrivateKey) Public + +```go +func (k Ed25519PrivateKey) Public() (SigningPublicKey, error) +``` + +#### func (Ed25519PrivateKey) Zero + +```go +func (k Ed25519PrivateKey) Zero() +``` + #### type Ed25519PublicKey ```go @@ -349,6 +551,18 @@ type Ed25519PublicKey []byte ``` +#### func CreateEd25519PublicKeyFromBytes + +```go +func CreateEd25519PublicKeyFromBytes(data []byte) (Ed25519PublicKey, error) +``` + +#### func (Ed25519PublicKey) Bytes + +```go +func (k Ed25519PublicKey) Bytes() []byte +``` + #### func (Ed25519PublicKey) Len ```go @@ -433,6 +647,12 @@ type ElgPublicKey [256]byte ``` +#### func (ElgPublicKey) Bytes + +```go +func (elg ElgPublicKey) Bytes() []byte +``` + #### func (ElgPublicKey) Len ```go @@ -509,6 +729,21 @@ type PrivateEncryptionKey interface { ``` +#### type PrivateKey + +```go +type PrivateKey interface { + // Public returns the public key corresponding to this private key + Public() (SigningPublicKey, error) + // Bytes returns the raw bytes of this private key + Bytes() []byte + // Zero clears all sensitive data from the private key + Zero() +} +``` + +PrivateKey is an interface for private keys + #### type PublicEncryptionKey ```go @@ -527,7 +762,7 @@ type PublicEncryptionKey interface { ```go type PublicKey interface { Len() int - NewEncrypter() (Encrypter, error) + Bytes() []byte } ``` @@ -546,6 +781,27 @@ type RSA2048PublicKey [256]byte ``` +#### func (RSA2048PublicKey) Bytes + +```go +func (r RSA2048PublicKey) Bytes() []byte +``` +Bytes implements SigningPublicKey. + +#### func (RSA2048PublicKey) Len + +```go +func (r RSA2048PublicKey) Len() int +``` +Len implements SigningPublicKey. + +#### func (RSA2048PublicKey) NewVerifier + +```go +func (r RSA2048PublicKey) NewVerifier() (Verifier, error) +``` +NewVerifier implements SigningPublicKey. + #### type RSA3072PrivateKey ```go @@ -560,6 +816,27 @@ type RSA3072PublicKey [384]byte ``` +#### func (RSA3072PublicKey) Bytes + +```go +func (r RSA3072PublicKey) Bytes() []byte +``` +Bytes implements SigningPublicKey. + +#### func (RSA3072PublicKey) Len + +```go +func (r RSA3072PublicKey) Len() int +``` +Len implements SigningPublicKey. + +#### func (RSA3072PublicKey) NewVerifier + +```go +func (r RSA3072PublicKey) NewVerifier() (Verifier, error) +``` +NewVerifier implements SigningPublicKey. + #### type RSA4096PrivateKey ```go @@ -574,6 +851,38 @@ type RSA4096PublicKey [512]byte ``` +#### func (RSA4096PublicKey) Bytes + +```go +func (r RSA4096PublicKey) Bytes() []byte +``` +Bytes implements SigningPublicKey. + +#### func (RSA4096PublicKey) Len + +```go +func (r RSA4096PublicKey) Len() int +``` +Len implements SigningPublicKey. + +#### func (RSA4096PublicKey) NewVerifier + +```go +func (r RSA4096PublicKey) NewVerifier() (Verifier, error) +``` +NewVerifier implements SigningPublicKey. + +#### type RecievingPublicKey + +```go +type RecievingPublicKey interface { + Len() int + Bytes() []byte + NewEncrypter() (Encrypter, error) +} +``` + + #### type Signer ```go @@ -618,6 +927,7 @@ type SigningPublicKey interface { NewVerifier() (Verifier, error) // get the size of this public key Len() int + Bytes() []byte } ``` @@ -686,3 +996,1010 @@ type Verifier interface { ``` type for verifying signatures + +# crypto +-- + import "github.com/go-i2p/go-i2p/lib/crypto" + +package for i2p specific crpytography + +![crypto.svg](crypto) + +## Usage + +```go +const ( + IPAD = byte(0x36) + OPAD = byte(0x5C) +) +``` + +```go +var ( + Ed25519EncryptTooBig = oops.Errorf("failed to encrypt data, too big for Ed25519") + ErrInvalidPublicKeySize = oops.Errorf("failed to verify: invalid ed25519 public key size") +) +``` + +```go +var ( + ElgDecryptFail = oops.Errorf("failed to decrypt elgamal encrypted data") + ElgEncryptTooBig = oops.Errorf("failed to encrypt data, too big for elgamal") +) +``` + +```go +var ( + ErrBadSignatureSize = oops.Errorf("bad signature size") + ErrInvalidKeyFormat = oops.Errorf("invalid key format") + ErrInvalidSignature = oops.Errorf("invalid signature") +) +``` + +```go +var Curve25519EncryptTooBig = oops.Errorf("failed to encrypt data, too big for Curve25519") +``` + +```go +var SHA256 = sha256.Sum256 +``` + +#### func ElgamalGenerate + +```go +func ElgamalGenerate(priv *elgamal.PrivateKey, rand io.Reader) (err error) +``` +generate an elgamal key pair + +#### type AESSymmetricDecrypter + +```go +type AESSymmetricDecrypter struct { + Key []byte + IV []byte +} +``` + +AESSymmetricDecrypter implements the Decrypter interface using AES + +#### func (*AESSymmetricDecrypter) Decrypt + +```go +func (d *AESSymmetricDecrypter) Decrypt(data []byte) ([]byte, error) +``` +Decrypt decrypts data using AES-CBC with PKCS#7 padding + +#### func (*AESSymmetricDecrypter) DecryptNoPadding + +```go +func (d *AESSymmetricDecrypter) DecryptNoPadding(data []byte) ([]byte, error) +``` +DecryptNoPadding decrypts data using AES-CBC without padding + +#### type AESSymmetricEncrypter + +```go +type AESSymmetricEncrypter struct { + Key []byte + IV []byte +} +``` + +AESSymmetricEncrypter implements the Encrypter interface using AES + +#### func (*AESSymmetricEncrypter) Encrypt + +```go +func (e *AESSymmetricEncrypter) Encrypt(data []byte) ([]byte, error) +``` +Encrypt encrypts data using AES-CBC with PKCS#7 padding + +#### func (*AESSymmetricEncrypter) EncryptNoPadding + +```go +func (e *AESSymmetricEncrypter) EncryptNoPadding(data []byte) ([]byte, error) +``` +EncryptNoPadding encrypts data using AES-CBC without padding + +#### type AESSymmetricKey + +```go +type AESSymmetricKey struct { + Key []byte // AES key (must be 16, 24, or 32 bytes for AES-128, AES-192, AES-256) + IV []byte // Initialization Vector (must be 16 bytes for AES) +} +``` + +AESSymmetricKey represents a symmetric key for AES encryption/decryption + +#### func (*AESSymmetricKey) Len + +```go +func (k *AESSymmetricKey) Len() int +``` +Len returns the length of the key + +#### func (*AESSymmetricKey) NewDecrypter + +```go +func (k *AESSymmetricKey) NewDecrypter() (Decrypter, error) +``` +NewDecrypter creates a new AESSymmetricDecrypter + +#### func (*AESSymmetricKey) NewEncrypter + +```go +func (k *AESSymmetricKey) NewEncrypter() (Encrypter, error) +``` +NewEncrypter creates a new AESSymmetricEncrypter + +#### type Curve25519Encryption + +```go +type Curve25519Encryption struct { +} +``` + + +#### func (*Curve25519Encryption) Encrypt + +```go +func (curve25519 *Curve25519Encryption) Encrypt(data []byte) (enc []byte, err error) +``` + +#### func (*Curve25519Encryption) EncryptPadding + +```go +func (curve25519 *Curve25519Encryption) EncryptPadding(data []byte, zeroPadding bool) (encrypted []byte, err error) +``` + +#### type Curve25519PrivateKey + +```go +type Curve25519PrivateKey curve25519.PrivateKey +``` + + +#### type Curve25519PublicKey + +```go +type Curve25519PublicKey []byte +``` + + +#### func (Curve25519PublicKey) Len + +```go +func (k Curve25519PublicKey) Len() int +``` + +#### func (Curve25519PublicKey) NewEncrypter + +```go +func (elg Curve25519PublicKey) NewEncrypter() (enc Encrypter, err error) +``` + +#### func (Curve25519PublicKey) NewVerifier + +```go +func (k Curve25519PublicKey) NewVerifier() (v Verifier, err error) +``` + +#### type Curve25519Signer + +```go +type Curve25519Signer struct { +} +``` + + +#### func (*Curve25519Signer) Sign + +```go +func (s *Curve25519Signer) Sign(data []byte) (sig []byte, err error) +``` + +#### func (*Curve25519Signer) SignHash + +```go +func (s *Curve25519Signer) SignHash(h []byte) (sig []byte, err error) +``` + +#### type Curve25519Verifier + +```go +type Curve25519Verifier struct { +} +``` + + +#### func (*Curve25519Verifier) Verify + +```go +func (v *Curve25519Verifier) Verify(data, sig []byte) (err error) +``` + +#### func (*Curve25519Verifier) VerifyHash + +```go +func (v *Curve25519Verifier) VerifyHash(h, sig []byte) (err error) +``` + +#### type DSAPrivateKey + +```go +type DSAPrivateKey [20]byte +``` + + +#### func (DSAPrivateKey) Generate + +```go +func (k DSAPrivateKey) Generate() (s DSAPrivateKey, err error) +``` + +#### func (DSAPrivateKey) Len + +```go +func (k DSAPrivateKey) Len() int +``` + +#### func (DSAPrivateKey) NewSigner + +```go +func (k DSAPrivateKey) NewSigner() (s Signer, err error) +``` +create a new dsa signer + +#### func (DSAPrivateKey) Public + +```go +func (k DSAPrivateKey) Public() (pk DSAPublicKey, err error) +``` + +#### type DSAPublicKey + +```go +type DSAPublicKey [128]byte +``` + + +#### func (DSAPublicKey) Bytes + +```go +func (k DSAPublicKey) Bytes() []byte +``` + +#### func (DSAPublicKey) Len + +```go +func (k DSAPublicKey) Len() int +``` + +#### func (DSAPublicKey) NewVerifier + +```go +func (k DSAPublicKey) NewVerifier() (v Verifier, err error) +``` +create a new dsa verifier + +#### type DSASigner + +```go +type DSASigner struct { +} +``` + + +#### func (*DSASigner) Sign + +```go +func (ds *DSASigner) Sign(data []byte) (sig []byte, err error) +``` + +#### func (*DSASigner) SignHash + +```go +func (ds *DSASigner) SignHash(h []byte) (sig []byte, err error) +``` + +#### type DSAVerifier + +```go +type DSAVerifier struct { +} +``` + + +#### func (*DSAVerifier) Verify + +```go +func (v *DSAVerifier) Verify(data, sig []byte) (err error) +``` +verify data with a dsa public key + +#### func (*DSAVerifier) VerifyHash + +```go +func (v *DSAVerifier) VerifyHash(h, sig []byte) (err error) +``` +verify hash of data with a dsa public key + +#### type Decrypter + +```go +type Decrypter interface { + // decrypt a block of data + // return decrypted block or nil and error if error happens + Decrypt(data []byte) ([]byte, error) +} +``` + +decrypts data + +#### type ECDSAVerifier + +```go +type ECDSAVerifier struct { +} +``` + + +#### func (*ECDSAVerifier) Verify + +```go +func (v *ECDSAVerifier) Verify(data, sig []byte) (err error) +``` +verify a block of data by hashing it and comparing the hash against the +signature + +#### func (*ECDSAVerifier) VerifyHash + +```go +func (v *ECDSAVerifier) VerifyHash(h, sig []byte) (err error) +``` +verify a signature given the hash + +#### type ECP256PrivateKey + +```go +type ECP256PrivateKey [32]byte +``` + + +#### type ECP256PublicKey + +```go +type ECP256PublicKey [64]byte +``` + + +#### func (ECP256PublicKey) Bytes + +```go +func (k ECP256PublicKey) Bytes() []byte +``` + +#### func (ECP256PublicKey) Len + +```go +func (k ECP256PublicKey) Len() int +``` + +#### func (ECP256PublicKey) NewVerifier + +```go +func (k ECP256PublicKey) NewVerifier() (Verifier, error) +``` + +#### type ECP384PrivateKey + +```go +type ECP384PrivateKey [48]byte +``` + + +#### type ECP384PublicKey + +```go +type ECP384PublicKey [96]byte +``` + + +#### func (ECP384PublicKey) Bytes + +```go +func (k ECP384PublicKey) Bytes() []byte +``` + +#### func (ECP384PublicKey) Len + +```go +func (k ECP384PublicKey) Len() int +``` + +#### func (ECP384PublicKey) NewVerifier + +```go +func (k ECP384PublicKey) NewVerifier() (Verifier, error) +``` + +#### type ECP521PrivateKey + +```go +type ECP521PrivateKey [66]byte +``` + + +#### type ECP521PublicKey + +```go +type ECP521PublicKey [132]byte +``` + + +#### func (ECP521PublicKey) Bytes + +```go +func (k ECP521PublicKey) Bytes() []byte +``` + +#### func (ECP521PublicKey) Len + +```go +func (k ECP521PublicKey) Len() int +``` + +#### func (ECP521PublicKey) NewVerifier + +```go +func (k ECP521PublicKey) NewVerifier() (Verifier, error) +``` + +#### type Ed25519Decrypter + +```go +type Ed25519Decrypter struct { +} +``` + + +#### func (*Ed25519Decrypter) Decrypt + +```go +func (d *Ed25519Decrypter) Decrypt(data []byte) ([]byte, error) +``` + +#### func (*Ed25519Decrypter) DecryptPadding + +```go +func (d *Ed25519Decrypter) DecryptPadding(data []byte, zeroPadding bool) ([]byte, error) +``` + +#### type Ed25519Encryption + +```go +type Ed25519Encryption struct { +} +``` + + +#### func (*Ed25519Encryption) Encrypt + +```go +func (ed25519 *Ed25519Encryption) Encrypt(data []byte) (enc []byte, err error) +``` + +#### func (*Ed25519Encryption) EncryptPadding + +```go +func (ed25519 *Ed25519Encryption) EncryptPadding(data []byte, zeroPadding bool) (encrypted []byte, err error) +``` + +#### type Ed25519PrivateKey + +```go +type Ed25519PrivateKey ed25519.PrivateKey +``` + + +#### func (Ed25519PrivateKey) Bytes + +```go +func (k Ed25519PrivateKey) Bytes() []byte +``` + +#### func (Ed25519PrivateKey) Generate + +```go +func (k Ed25519PrivateKey) Generate() (SigningPrivateKey, error) +``` + +#### func (Ed25519PrivateKey) Len + +```go +func (k Ed25519PrivateKey) Len() int +``` + +#### func (Ed25519PrivateKey) NewDecrypter + +```go +func (k Ed25519PrivateKey) NewDecrypter() (Decrypter, error) +``` + +#### func (Ed25519PrivateKey) NewSigner + +```go +func (k Ed25519PrivateKey) NewSigner() (Signer, error) +``` + +#### func (Ed25519PrivateKey) Public + +```go +func (k Ed25519PrivateKey) Public() (SigningPublicKey, error) +``` + +#### func (Ed25519PrivateKey) Zero + +```go +func (k Ed25519PrivateKey) Zero() +``` + +#### type Ed25519PublicKey + +```go +type Ed25519PublicKey []byte +``` + + +#### func CreateEd25519PublicKeyFromBytes + +```go +func CreateEd25519PublicKeyFromBytes(data []byte) (Ed25519PublicKey, error) +``` + +#### func (Ed25519PublicKey) Bytes + +```go +func (k Ed25519PublicKey) Bytes() []byte +``` + +#### func (Ed25519PublicKey) Len + +```go +func (k Ed25519PublicKey) Len() int +``` + +#### func (Ed25519PublicKey) NewEncrypter + +```go +func (elg Ed25519PublicKey) NewEncrypter() (enc Encrypter, err error) +``` + +#### func (Ed25519PublicKey) NewVerifier + +```go +func (k Ed25519PublicKey) NewVerifier() (v Verifier, err error) +``` + +#### type Ed25519Signer + +```go +type Ed25519Signer struct { +} +``` + + +#### func (*Ed25519Signer) Sign + +```go +func (s *Ed25519Signer) Sign(data []byte) (sig []byte, err error) +``` + +#### func (*Ed25519Signer) SignHash + +```go +func (s *Ed25519Signer) SignHash(h []byte) (sig []byte, err error) +``` + +#### type Ed25519Verifier + +```go +type Ed25519Verifier struct { +} +``` + + +#### func (*Ed25519Verifier) Verify + +```go +func (v *Ed25519Verifier) Verify(data, sig []byte) (err error) +``` + +#### func (*Ed25519Verifier) VerifyHash + +```go +func (v *Ed25519Verifier) VerifyHash(h, sig []byte) (err error) +``` + +#### type ElgPrivateKey + +```go +type ElgPrivateKey [256]byte +``` + + +#### func (ElgPrivateKey) Len + +```go +func (elg ElgPrivateKey) Len() int +``` + +#### func (ElgPrivateKey) NewDecrypter + +```go +func (elg ElgPrivateKey) NewDecrypter() (dec Decrypter, err error) +``` + +#### type ElgPublicKey + +```go +type ElgPublicKey [256]byte +``` + + +#### func (ElgPublicKey) Bytes + +```go +func (elg ElgPublicKey) Bytes() []byte +``` + +#### func (ElgPublicKey) Len + +```go +func (elg ElgPublicKey) Len() int +``` + +#### func (ElgPublicKey) NewEncrypter + +```go +func (elg ElgPublicKey) NewEncrypter() (enc Encrypter, err error) +``` + +#### type ElgamalEncryption + +```go +type ElgamalEncryption struct { +} +``` + + +#### func (*ElgamalEncryption) Encrypt + +```go +func (elg *ElgamalEncryption) Encrypt(data []byte) (enc []byte, err error) +``` + +#### func (*ElgamalEncryption) EncryptPadding + +```go +func (elg *ElgamalEncryption) EncryptPadding(data []byte, zeroPadding bool) (encrypted []byte, err error) +``` + +#### type Encrypter + +```go +type Encrypter interface { + // encrypt a block of data + // return encrypted block or nil and error if an error happened + Encrypt(data []byte) (enc []byte, err error) +} +``` + +encrypts data + +#### type HMACDigest + +```go +type HMACDigest [16]byte +``` + + +#### func I2PHMAC + +```go +func I2PHMAC(data []byte, k HMACKey) (d HMACDigest) +``` +do i2p hmac + +#### type HMACKey + +```go +type HMACKey [32]byte +``` + + +#### type PrivateEncryptionKey + +```go +type PrivateEncryptionKey interface { + // create a new decryption object for this private key to decrypt data encrypted to our public key + // returns decrypter or nil and error if the private key is in a bad format + NewDecrypter() (Decrypter, error) +} +``` + + +#### type PrivateKey + +```go +type PrivateKey interface { + // Public returns the public key corresponding to this private key + Public() (SigningPublicKey, error) + // Bytes returns the raw bytes of this private key + Bytes() []byte + // Zero clears all sensitive data from the private key + Zero() +} +``` + +PrivateKey is an interface for private keys + +#### type PublicEncryptionKey + +```go +type PublicEncryptionKey interface { + // create a new encrypter to encrypt data to this public key + NewEncrypter() (Encrypter, error) + + // length of this public key in bytes + Len() int +} +``` + + +#### type PublicKey + +```go +type PublicKey interface { + Len() int + Bytes() []byte +} +``` + + +#### type RSA2048PrivateKey + +```go +type RSA2048PrivateKey [512]byte +``` + + +#### type RSA2048PublicKey + +```go +type RSA2048PublicKey [256]byte +``` + + +#### func (RSA2048PublicKey) Bytes + +```go +func (r RSA2048PublicKey) Bytes() []byte +``` +Bytes implements SigningPublicKey. + +#### func (RSA2048PublicKey) Len + +```go +func (r RSA2048PublicKey) Len() int +``` +Len implements SigningPublicKey. + +#### func (RSA2048PublicKey) NewVerifier + +```go +func (r RSA2048PublicKey) NewVerifier() (Verifier, error) +``` +NewVerifier implements SigningPublicKey. + +#### type RSA3072PrivateKey + +```go +type RSA3072PrivateKey [786]byte +``` + + +#### type RSA3072PublicKey + +```go +type RSA3072PublicKey [384]byte +``` + + +#### func (RSA3072PublicKey) Bytes + +```go +func (r RSA3072PublicKey) Bytes() []byte +``` +Bytes implements SigningPublicKey. + +#### func (RSA3072PublicKey) Len + +```go +func (r RSA3072PublicKey) Len() int +``` +Len implements SigningPublicKey. + +#### func (RSA3072PublicKey) NewVerifier + +```go +func (r RSA3072PublicKey) NewVerifier() (Verifier, error) +``` +NewVerifier implements SigningPublicKey. + +#### type RSA4096PrivateKey + +```go +type RSA4096PrivateKey [1024]byte +``` + + +#### type RSA4096PublicKey + +```go +type RSA4096PublicKey [512]byte +``` + + +#### func (RSA4096PublicKey) Bytes + +```go +func (r RSA4096PublicKey) Bytes() []byte +``` +Bytes implements SigningPublicKey. + +#### func (RSA4096PublicKey) Len + +```go +func (r RSA4096PublicKey) Len() int +``` +Len implements SigningPublicKey. + +#### func (RSA4096PublicKey) NewVerifier + +```go +func (r RSA4096PublicKey) NewVerifier() (Verifier, error) +``` +NewVerifier implements SigningPublicKey. + +#### type RecievingPublicKey + +```go +type RecievingPublicKey interface { + Len() int + Bytes() []byte + NewEncrypter() (Encrypter, error) +} +``` + + +#### type Signer + +```go +type Signer interface { + // sign data with our private key by calling SignHash after hashing the data we are given + // return signature or nil signature and error if an error happened + Sign(data []byte) (sig []byte, err error) + + // sign hash of data with our private key + // return signature or nil signature and error if an error happened + SignHash(h []byte) (sig []byte, err error) +} +``` + +type for signing data + +#### type SigningPrivateKey + +```go +type SigningPrivateKey interface { + // create a new signer to sign data + // return signer or nil and error if key format is invalid + NewSigner() (Signer, error) + // length of this private key + Len() int + // get public key or return nil and error if invalid key data in private key + Public() (SigningPublicKey, error) + // generate a new private key, put it into itself + // returns itself or nil and error if an error occurs + Generate() (SigningPrivateKey, error) +} +``` + +key for signing data + +#### type SigningPublicKey + +```go +type SigningPublicKey interface { + // create new Verifier to verify the validity of signatures + // return verifier or nil and error if key format is invalid + NewVerifier() (Verifier, error) + // get the size of this public key + Len() int + Bytes() []byte +} +``` + +key for verifying data + +#### type Tunnel + +```go +type Tunnel struct { +} +``` + + +#### func NewTunnelCrypto + +```go +func NewTunnelCrypto(layerKey, ivKey TunnelKey) (t *Tunnel, err error) +``` + +#### func (*Tunnel) Decrypt + +```go +func (t *Tunnel) Decrypt(td *TunnelData) +``` + +#### func (*Tunnel) Encrypt + +```go +func (t *Tunnel) Encrypt(td *TunnelData) +``` +encrypt tunnel data in place + +#### type TunnelData + +```go +type TunnelData [1028]byte +``` + + +#### type TunnelIV + +```go +type TunnelIV []byte +``` + +The initialization vector for a tunnel message + +#### type TunnelKey + +```go +type TunnelKey [32]byte +``` + +A symetric key for encrypting tunnel messages + +#### type Verifier + +```go +type Verifier interface { + // verify hashed data with this signing key + // return nil on valid signature otherwise error + VerifyHash(h, sig []byte) error + // verify an unhashed piece of data by hashing it and calling VerifyHash + Verify(data, sig []byte) error +} +``` + +type for verifying signatures + + + +crypto + +github.com/go-i2p/go-i2p/lib/crypto diff --git a/lib/i2np/doc.md b/lib/i2np/doc.md index e63adff..8b72071 100644 --- a/lib/i2np/doc.md +++ b/lib/i2np/doc.md @@ -23,11 +23,11 @@ const ( ``` ```go -var ERR_BUILD_REQUEST_RECORD_NOT_ENOUGH_DATA = errors.New("not enough i2np build request record data") +var ERR_BUILD_REQUEST_RECORD_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np build request record data") ``` ```go -var ERR_I2NP_NOT_ENOUGH_DATA = errors.New("not enough i2np header data") +var ERR_I2NP_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np header data") ``` #### func ReadI2NPNTCPData @@ -341,3 +341,356 @@ type VariableTunnelBuildReply struct { BuildResponseRecords []BuildResponseRecord } ``` + +# i2np +-- + import "github.com/go-i2p/go-i2p/lib/i2np" + + + +![i2np.svg](i2np) + +## Usage + +```go +const ( + I2NP_MESSAGE_TYPE_DATABASE_STORE = 1 + I2NP_MESSAGE_TYPE_DATABASE_LOOKUP = 2 + I2NP_MESSAGE_TYPE_DATABASE_SEARCH_REPLY = 3 + I2NP_MESSAGE_TYPE_DELIVERY_STATUS = 10 + I2NP_MESSAGE_TYPE_GARLIC = 11 + I2NP_MESSAGE_TYPE_TUNNEL_DATA = 18 + I2NP_MESSAGE_TYPE_TUNNEL_GATEWAY = 19 + I2NP_MESSAGE_TYPE_DATA = 20 + I2NP_MESSAGE_TYPE_TUNNEL_BUILD = 21 + I2NP_MESSAGE_TYPE_TUNNEL_BUILD_REPLY = 22 + I2NP_MESSAGE_TYPE_VARIABLE_TUNNEL_BUILD = 23 + I2NP_MESSAGE_TYPE_VARIABLE_TUNNEL_BUILD_REPLY = 24 +) +``` + +```go +var ERR_BUILD_REQUEST_RECORD_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np build request record data") +``` + +```go +var ERR_I2NP_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np header data") +``` + +#### func ReadI2NPNTCPData + +```go +func ReadI2NPNTCPData(data []byte, size int) ([]byte, error) +``` + +#### func ReadI2NPNTCPMessageChecksum + +```go +func ReadI2NPNTCPMessageChecksum(data []byte) (int, error) +``` + +#### func ReadI2NPNTCPMessageExpiration + +```go +func ReadI2NPNTCPMessageExpiration(data []byte) (datalib.Date, error) +``` + +#### func ReadI2NPNTCPMessageID + +```go +func ReadI2NPNTCPMessageID(data []byte) (int, error) +``` + +#### func ReadI2NPNTCPMessageSize + +```go +func ReadI2NPNTCPMessageSize(data []byte) (int, error) +``` + +#### func ReadI2NPSSUMessageExpiration + +```go +func ReadI2NPSSUMessageExpiration(data []byte) (datalib.Date, error) +``` + +#### func ReadI2NPType + +```go +func ReadI2NPType(data []byte) (int, error) +``` + +#### type BuildRequestRecord + +```go +type BuildRequestRecord struct { + ReceiveTunnel tunnel.TunnelID + OurIdent common.Hash + NextTunnel tunnel.TunnelID + NextIdent common.Hash + LayerKey session_key.SessionKey + IVKey session_key.SessionKey + ReplyKey session_key.SessionKey + ReplyIV [16]byte + Flag int + RequestTime time.Time + SendMessageID int + Padding [29]byte +} +``` + + +#### func ReadBuildRequestRecord + +```go +func ReadBuildRequestRecord(data []byte) (BuildRequestRecord, error) +``` + +#### type BuildRequestRecordElGamal + +```go +type BuildRequestRecordElGamal [528]byte +``` + + +#### type BuildRequestRecordElGamalAES + +```go +type BuildRequestRecordElGamalAES [528]byte +``` + + +#### type BuildResponseRecord + +```go +type BuildResponseRecord struct { + Hash common.Hash + Padding [495]byte + Reply byte +} +``` + + +#### type BuildResponseRecordELGamal + +```go +type BuildResponseRecordELGamal [528]byte +``` + + +#### type BuildResponseRecordELGamalAES + +```go +type BuildResponseRecordELGamalAES [528]byte +``` + + +#### type Data + +```go +type Data struct { + Length int + Data []byte +} +``` + + +#### type DatabaseLookup + +```go +type DatabaseLookup struct { + Key common.Hash + From common.Hash + Flags byte + ReplyTunnelID [4]byte + Size int + ExcludedPeers []common.Hash + ReplyKey session_key.SessionKey + + ReplyTags []session_tag.SessionTag +} +``` + + +#### type DatabaseSearchReply + +```go +type DatabaseSearchReply struct { + Key common.Hash + Count int + PeerHashes []common.Hash + From common.Hash +} +``` + + +#### type DatabaseStore + +```go +type DatabaseStore struct { + Key common.Hash + Type byte + ReplyToken [4]byte + ReplyTunnelID [4]byte + ReplyGateway common.Hash + Data []byte +} +``` + + +#### type DeliveryStatus + +```go +type DeliveryStatus struct { + MessageID int + Timestamp time.Time +} +``` + + +#### type Garlic + +```go +type Garlic struct { + Count int + Cloves []GarlicClove + Certificate certificate.Certificate + MessageID int + Expiration time.Time +} +``` + + +#### type GarlicClove + +```go +type GarlicClove struct { + DeliveryInstructions GarlicCloveDeliveryInstructions + I2NPMessage I2NPMessage + CloveID int + Expiration time.Time + Certificate certificate.Certificate +} +``` + + +#### type GarlicCloveDeliveryInstructions + +```go +type GarlicCloveDeliveryInstructions struct { + Flag byte + SessionKey session_key.SessionKey + Hash common.Hash + TunnelID tunnel.TunnelID + Delay int +} +``` + + +#### type GarlicElGamal + +```go +type GarlicElGamal []byte +``` + + +#### type I2NPMessage + +```go +type I2NPMessage []byte +``` + + +#### type I2NPNTCPHeader + +```go +type I2NPNTCPHeader struct { + Type int + MessageID int + Expiration time.Time + Size int + Checksum int + Data []byte +} +``` + + +#### func ReadI2NPNTCPHeader + +```go +func ReadI2NPNTCPHeader(data []byte) (I2NPNTCPHeader, error) +``` +Read an entire I2NP message and return the parsed header with embedded encrypted +data + +#### type I2NPSSUHeader + +```go +type I2NPSSUHeader struct { + Type int + Expiration time.Time +} +``` + + +#### func ReadI2NPSSUHeader + +```go +func ReadI2NPSSUHeader(data []byte) (I2NPSSUHeader, error) +``` + +#### type TunnelBuild + +```go +type TunnelBuild [8]BuildRequestRecord +``` + + +#### type TunnelBuildReply + +```go +type TunnelBuildReply [8]BuildResponseRecord +``` + + +#### type TunnelData + +```go +type TunnelData [1028]byte +``` + + +#### type TunnelGatway + +```go +type TunnelGatway struct { + TunnelID tunnel.TunnelID + Length int + Data []byte +} +``` + + +#### type VariableTunnelBuild + +```go +type VariableTunnelBuild struct { + Count int + BuildRequestRecords []BuildRequestRecord +} +``` + + +#### type VariableTunnelBuildReply + +```go +type VariableTunnelBuildReply struct { + Count int + BuildResponseRecords []BuildResponseRecord +} +``` + + + +i2np + +github.com/go-i2p/go-i2p/lib/i2np diff --git a/lib/i2np/fuzz/header/doc.md b/lib/i2np/fuzz/header/doc.md index 5d85fcc..d6fe90a 100644 --- a/lib/i2np/fuzz/header/doc.md +++ b/lib/i2np/fuzz/header/doc.md @@ -10,3 +10,25 @@ ```go func Fuzz(data []byte) int ``` + +# exportable +-- + import "github.com/go-i2p/go-i2p/lib/i2np/fuzz/header" + + + +![exportable.svg](exportable) + +## Usage + +#### func Fuzz + +```go +func Fuzz(data []byte) int +``` + + + +exportable + +github.com/go-i2p/go-i2p/lib/i2np/fuzz/header diff --git a/lib/i2np/fuzz/header/exportable.svg b/lib/i2np/fuzz/header/exportable.svg new file mode 100644 index 0000000..78bd97d --- /dev/null +++ b/lib/i2np/fuzz/header/exportable.svg @@ -0,0 +1,53 @@ + + + + + + +gocallvis + + +cluster_focus + +exportable + + +cluster_github.com/go-i2p/go-i2p/lib/i2np + + +i2np + + + + + +github.com/go-i2p/go-i2p/lib/i2np/fuzz/header.Fuzz + + +Fuzz + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader + + +ReadI2NPNTCPHeader + + + + + +github.com/go-i2p/go-i2p/lib/i2np/fuzz/header.Fuzz->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader + + + + + + + + diff --git a/lib/i2np/i2np.svg b/lib/i2np/i2np.svg new file mode 100644 index 0000000..fa3eb54 --- /dev/null +++ b/lib/i2np/i2np.svg @@ -0,0 +1,1126 @@ + + + + + + +gocallvis + + +cluster_focus + +i2np + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Date + + +(Date) + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPData + + +ReadI2NPNTCPData + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPData->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPData->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReceiveTunnel + + +readBuildRequestRecordReceiveTunnel + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReceiveTunnel->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReceiveTunnel->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReceiveTunnel->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUMessageExpiration + + +ReadI2NPSSUMessageExpiration + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUMessageExpiration->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUMessageExpiration->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord + + +ReadBuildRequestRecord + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReceiveTunnel + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordOurIdent + + +readBuildRequestRecordOurIdent + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordOurIdent + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextTunnel + + +readBuildRequestRecordNextTunnel + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextTunnel + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextIdent + + +readBuildRequestRecordNextIdent + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextIdent + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordLayerKey + + +readBuildRequestRecordLayerKey + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordLayerKey + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordIVKey + + +readBuildRequestRecordIVKey + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordIVKey + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyKey + + +readBuildRequestRecordReplyKey + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyKey + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyIV + + +readBuildRequestRecordReplyIV + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyIV + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordFlag + + +readBuildRequestRecordFlag + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordFlag + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordRequestTime + + +readBuildRequestRecordRequestTime + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordRequestTime + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordSendMessageID + + +readBuildRequestRecordSendMessageID + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordSendMessageID + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordPadding + + +readBuildRequestRecordPadding + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordPadding + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadBuildRequestRecord->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordOurIdent->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordOurIdent->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextTunnel->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextTunnel->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextTunnel->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextIdent->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordNextIdent->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordLayerKey->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordLayerKey->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordIVKey->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordIVKey->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyKey->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyKey->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyIV->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordReplyIV->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordFlag->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordFlag->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordFlag->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordRequestTime->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordRequestTime->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordRequestTime->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordSendMessageID->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordSendMessageID->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordSendMessageID->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordPadding->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.readBuildRequestRecordPadding->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageExpiration + + +ReadI2NPNTCPMessageExpiration + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageExpiration->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageExpiration->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageChecksum + + +ReadI2NPNTCPMessageChecksum + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageChecksum->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageChecksum->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageChecksum->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageSize + + +ReadI2NPNTCPMessageSize + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageSize->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageSize->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageSize->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPType + + +ReadI2NPType + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPType->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPType->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPType->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPType->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader + + +ReadI2NPSSUHeader + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUMessageExpiration + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + +Time + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader->(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPSSUHeader->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageID + + +ReadI2NPNTCPMessageID + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageID->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageID->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageID->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader + + +ReadI2NPNTCPHeader + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPData + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageExpiration + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageChecksum + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageSize + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPType + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPMessageID + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->(github.com/go-i2p/go-i2p/lib/common/data.Date).Time + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.ReadI2NPNTCPHeader->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/i2np.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/i2np.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/i2np.init->github.com/samber/oops.Errorf + + + + + + + + diff --git a/lib/keys/doc.md b/lib/keys/doc.md new file mode 100644 index 0000000..9e375e0 --- /dev/null +++ b/lib/keys/doc.md @@ -0,0 +1,202 @@ +# keys +-- + import "github.com/go-i2p/go-i2p/lib/keys" + + +## Usage + +#### type KeyStore + +```go +type KeyStore interface { + KeyID() string + // GetKeys returns the public and private keys + GetKeys() (publicKey crypto.PublicKey, privateKey crypto.PrivateKey, err error) + // StoreKeys stores the keys + StoreKeys() error +} +``` + +KeyStore is an interface for storing and retrieving keys + +#### type KeyStoreImpl + +```go +type KeyStoreImpl struct { +} +``` + + +#### func NewKeyStoreImpl + +```go +func NewKeyStoreImpl(dir, name string, privateKey crypto.PrivateKey) *KeyStoreImpl +``` + +#### func (*KeyStoreImpl) GetKeys + +```go +func (ks *KeyStoreImpl) GetKeys() (crypto.PublicKey, crypto.PrivateKey, error) +``` + +#### func (*KeyStoreImpl) KeyID + +```go +func (ks *KeyStoreImpl) KeyID() string +``` + +#### func (*KeyStoreImpl) StoreKeys + +```go +func (ks *KeyStoreImpl) StoreKeys() error +``` + +#### type RouterInfoKeystore + +```go +type RouterInfoKeystore struct { + *sntp.RouterTimestamper +} +``` + +RouterInfoKeystore is an implementation of KeyStore for storing and retrieving +RouterInfo private keys and exporting RouterInfos + +#### func NewRouterInfoKeystore + +```go +func NewRouterInfoKeystore(dir, name string) (*RouterInfoKeystore, error) +``` +NewRouterInfoKeystore creates a new RouterInfoKeystore with fresh and new +private keys it accepts a directory to store the keys in and a name for the keys +then it generates new private keys for the routerInfo if none exist + +#### func (*RouterInfoKeystore) ConstructRouterInfo + +```go +func (ks *RouterInfoKeystore) ConstructRouterInfo(addresses []*router_address.RouterAddress) (*router_info.RouterInfo, error) +``` + +#### func (*RouterInfoKeystore) GetKeys + +```go +func (ks *RouterInfoKeystore) GetKeys() (crypto.PublicKey, crypto.PrivateKey, error) +``` + +#### func (*RouterInfoKeystore) KeyID + +```go +func (ks *RouterInfoKeystore) KeyID() string +``` + +#### func (*RouterInfoKeystore) StoreKeys + +```go +func (ks *RouterInfoKeystore) StoreKeys() error +``` + +# keys +-- + import "github.com/go-i2p/go-i2p/lib/keys" + + + +![keys.svg](keys) + +## Usage + +#### type KeyStore + +```go +type KeyStore interface { + KeyID() string + // GetKeys returns the public and private keys + GetKeys() (publicKey crypto.PublicKey, privateKey crypto.PrivateKey, err error) + // StoreKeys stores the keys + StoreKeys() error +} +``` + +KeyStore is an interface for storing and retrieving keys + +#### type KeyStoreImpl + +```go +type KeyStoreImpl struct { +} +``` + + +#### func NewKeyStoreImpl + +```go +func NewKeyStoreImpl(dir, name string, privateKey crypto.PrivateKey) *KeyStoreImpl +``` + +#### func (*KeyStoreImpl) GetKeys + +```go +func (ks *KeyStoreImpl) GetKeys() (crypto.PublicKey, crypto.PrivateKey, error) +``` + +#### func (*KeyStoreImpl) KeyID + +```go +func (ks *KeyStoreImpl) KeyID() string +``` + +#### func (*KeyStoreImpl) StoreKeys + +```go +func (ks *KeyStoreImpl) StoreKeys() error +``` + +#### type RouterInfoKeystore + +```go +type RouterInfoKeystore struct { + *sntp.RouterTimestamper +} +``` + +RouterInfoKeystore is an implementation of KeyStore for storing and retrieving +RouterInfo private keys and exporting RouterInfos + +#### func NewRouterInfoKeystore + +```go +func NewRouterInfoKeystore(dir, name string) (*RouterInfoKeystore, error) +``` +NewRouterInfoKeystore creates a new RouterInfoKeystore with fresh and new +private keys it accepts a directory to store the keys in and a name for the keys +then it generates new private keys for the routerInfo if none exist + +#### func (*RouterInfoKeystore) ConstructRouterInfo + +```go +func (ks *RouterInfoKeystore) ConstructRouterInfo(addresses []*router_address.RouterAddress) (*router_info.RouterInfo, error) +``` + +#### func (*RouterInfoKeystore) GetKeys + +```go +func (ks *RouterInfoKeystore) GetKeys() (crypto.PublicKey, crypto.PrivateKey, error) +``` + +#### func (*RouterInfoKeystore) KeyID + +```go +func (ks *RouterInfoKeystore) KeyID() string +``` + +#### func (*RouterInfoKeystore) StoreKeys + +```go +func (ks *RouterInfoKeystore) StoreKeys() error +``` + + + +keys + +github.com/go-i2p/go-i2p/lib/keys diff --git a/lib/keys/keys.svg b/lib/keys/keys.svg new file mode 100644 index 0000000..8118f5f --- /dev/null +++ b/lib/keys/keys.svg @@ -0,0 +1,421 @@ + + + + + + +gocallvis + + +cluster_focus + +keys + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/go-i2p/lib/util/time/sntp + + +sntp + + + + +cluster_*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper + + +(*RouterTimestamper) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info + + +router_info + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_identity + + +router_identity + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate + + +key_certificate + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate + + +(KeyCertificate) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/certificate + + +certificate + + + + +cluster_*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore + + +(*RouterInfoKeystore) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/keys.KeyStoreImpl + + +(*KeyStoreImpl) + + + + + +github.com/go-i2p/go-i2p/lib/keys.loadExistingKey + + +loadExistingKey + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/keys.loadExistingKey->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/keys.NewRouterInfoKeystore + + +NewRouterInfoKeystore + + + + + +github.com/go-i2p/go-i2p/lib/keys.NewRouterInfoKeystore->github.com/go-i2p/go-i2p/lib/keys.loadExistingKey + + + + + + + + +github.com/go-i2p/go-i2p/lib/keys.generateNewKey + + +generateNewKey + + + + + +github.com/go-i2p/go-i2p/lib/keys.NewRouterInfoKeystore->github.com/go-i2p/go-i2p/lib/keys.generateNewKey + + + + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.NewRouterTimestamper + + +NewRouterTimestamper + + + + + +github.com/go-i2p/go-i2p/lib/keys.NewRouterInfoKeystore->github.com/go-i2p/go-i2p/lib/util/time/sntp.NewRouterTimestamper + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.KeyStoreImpl).StoreKeys + + +StoreKeys + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.KeyStoreImpl).KeyID + + +KeyID + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.KeyStoreImpl).StoreKeys->(*github.com/go-i2p/go-i2p/lib/keys.KeyStoreImpl).KeyID + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo + + +ConstructRouterInfo + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).GetKeys + + +GetKeys + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).GetKeys + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateWithType + + +NewCertificateWithType + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->github.com/go-i2p/go-i2p/lib/common/certificate.NewCertificateWithType + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + +NewIntegerFromInt + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->github.com/go-i2p/go-i2p/lib/common/data.NewIntegerFromInt + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + +KeyCertificateFromCertificate + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificateFromCertificate + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize + + +CryptoSize + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).CryptoSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + +SignatureSize + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->(github.com/go-i2p/go-i2p/lib/common/key_certificate.KeyCertificate).SignatureSize + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity + + +NewRouterIdentity + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->github.com/go-i2p/go-i2p/lib/common/router_identity.NewRouterIdentity + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo + + +NewRouterInfo + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->github.com/go-i2p/go-i2p/lib/common/router_info.NewRouterInfo + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).GetCurrentTime + + +GetCurrentTime + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).GetCurrentTime + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).StoreKeys + + +StoreKeys + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).KeyID + + +KeyID + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).StoreKeys->(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).KeyID + + + + + + + + diff --git a/lib/netdb/doc.md b/lib/netdb/doc.md index 1a6c205..4f2e76e 100644 --- a/lib/netdb/doc.md +++ b/lib/netdb/doc.md @@ -180,3 +180,195 @@ return how many routers we know about in our network database func (db *StdNetDB) SkiplistFile(hash common.Hash) (fpath string) ``` get the skiplist file that a RouterInfo with this hash would go in + +# netdb +-- + import "github.com/go-i2p/go-i2p/lib/netdb" + + + +![netdb.svg](netdb) + +## Usage + +```go +const CacheFileName = "sizecache.txt" +``` +name of file to hold precomputed size of netdb + +#### type Entry + +```go +type Entry struct { + *router_info.RouterInfo + *lease_set.LeaseSet +} +``` + +netdb entry wraps a router info and provides serialization + +#### func (*Entry) ReadFrom + +```go +func (e *Entry) ReadFrom(r io.Reader) (err error) +``` + +#### func (*Entry) WriteTo + +```go +func (e *Entry) WriteTo(w io.Writer) (err error) +``` + +#### type NetworkDatabase + +```go +type NetworkDatabase interface { + // obtain a RouterInfo by its hash locally + // return a RouterInfo if we found it locally + // return nil if the RouterInfo cannot be found locally + GetRouterInfo(hash common.Hash) router_info.RouterInfo + + // store a router info locally + StoreRouterInfo(ri router_info.RouterInfo) + + // try obtaining more peers with a bootstrap instance until we get minRouters number of router infos + // returns error if bootstrap.GetPeers returns an error otherwise returns nil + Reseed(b bootstrap.Bootstrap, minRouters int) error + + // return how many router infos we have + Size() int + + // Recaculate size of netdb from backend + RecalculateSize() error + + // ensure underlying resources exist , i.e. directories, files, configs + Ensure() error +} +``` + +i2p network database, storage of i2p RouterInfos + +#### type Resolver + +```go +type Resolver interface { + // resolve a router info by hash + // return a chan that yields the found RouterInfo or nil if it could not be found after timeout + Lookup(hash common.Hash, timeout time.Duration) chan router_info.RouterInfo +} +``` + +resolves unknown RouterInfos given the hash of their RouterIdentity + +#### func KademliaResolver + +```go +func KademliaResolver(netDb NetworkDatabase, pool *tunnel.Pool) (r Resolver) +``` +create a new resolver that stores result into a NetworkDatabase and uses a +tunnel pool for the lookup + +#### type StdNetDB + +```go +type StdNetDB struct { + DB string + RouterInfos map[common.Hash]Entry + LeaseSets map[common.Hash]Entry +} +``` + +standard network database implementation using local filesystem skiplist + +#### func NewStdNetDB + +```go +func NewStdNetDB(db string) StdNetDB +``` + +#### func (*StdNetDB) CheckFilePathValid + +```go +func (db *StdNetDB) CheckFilePathValid(fpath string) bool +``` + +#### func (*StdNetDB) Create + +```go +func (db *StdNetDB) Create() (err error) +``` +create base network database directory + +#### func (*StdNetDB) Ensure + +```go +func (db *StdNetDB) Ensure() (err error) +``` +ensure that the network database exists + +#### func (*StdNetDB) Exists + +```go +func (db *StdNetDB) Exists() bool +``` +return true if the network db directory exists and is writable + +#### func (*StdNetDB) GetRouterInfo + +```go +func (db *StdNetDB) GetRouterInfo(hash common.Hash) (chnl chan router_info.RouterInfo) +``` + +#### func (*StdNetDB) Path + +```go +func (db *StdNetDB) Path() string +``` +get netdb path + +#### func (*StdNetDB) RecalculateSize + +```go +func (db *StdNetDB) RecalculateSize() (err error) +``` +recalculateSize recalculates cached size of netdb + +#### func (*StdNetDB) Reseed + +```go +func (db *StdNetDB) Reseed(b bootstrap.Bootstrap, minRouters int) (err error) +``` +reseed if we have less than minRouters known routers returns error if reseed +failed + +#### func (*StdNetDB) Save + +```go +func (db *StdNetDB) Save() (err error) +``` + +#### func (*StdNetDB) SaveEntry + +```go +func (db *StdNetDB) SaveEntry(e *Entry) (err error) +``` + +#### func (*StdNetDB) Size + +```go +func (db *StdNetDB) Size() (routers int) +``` +return how many routers we know about in our network database + +#### func (*StdNetDB) SkiplistFile + +```go +func (db *StdNetDB) SkiplistFile(hash common.Hash) (fpath string) +``` +get the skiplist file that a RouterInfo with this hash would go in + + + +netdb + +github.com/go-i2p/go-i2p/lib/netdb diff --git a/lib/netdb/netdb.svg b/lib/netdb/netdb.svg new file mode 100644 index 0000000..ed760a2 --- /dev/null +++ b/lib/netdb/netdb.svg @@ -0,0 +1,845 @@ + + + + + + +gocallvis + + +cluster_focus + +netdb + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/util + + +util + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info + + +router_info + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(*RouterInfo) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/base64 + + +base64 + + + + +cluster_*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB + + +(*StdNetDB) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/netdb.Entry + + +(*Entry) + + + + + +github.com/go-i2p/go-i2p/lib/netdb.NewStdNetDB + + +NewStdNetDB + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/netdb.NewStdNetDB->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/netdb.NewStdNetDB->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/netdb.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/netdb.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.Entry).WriteTo + + +WriteTo + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Save + + +Save + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry + + +SaveEntry + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Save->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Save->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Save->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Save->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry->(*github.com/go-i2p/go-i2p/lib/netdb.Entry).WriteTo + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SkiplistFile + + +SkiplistFile + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SkiplistFile + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash + + +IdentHash + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SaveEntry->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Path + + +Path + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SkiplistFile->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Path + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/base64.EncodeToString + + +EncodeToString + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SkiplistFile->github.com/go-i2p/go-i2p/lib/common/base64.EncodeToString + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SkiplistFile->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SkiplistFile->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).GetRouterInfo + + +GetRouterInfo + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).GetRouterInfo->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).SkiplistFile + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo + + +ReadRouterInfo + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).GetRouterInfo->github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).GetRouterInfo->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).GetRouterInfo->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).GetRouterInfo->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).GetRouterInfo->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Reseed + + +Reseed + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size + + +Size + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Reseed->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Reseed->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Reseed->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Reseed->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).cacheFilePath + + +cacheFilePath + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).cacheFilePath + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize + + +RecalculateSize + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize + + + + + + + + +github.com/go-i2p/go-i2p/lib/util.CheckFileExists + + +CheckFileExists + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->github.com/go-i2p/go-i2p/lib/util.CheckFileExists + + + + + + + + +github.com/go-i2p/go-i2p/lib/util.CheckFileAge + + +CheckFileAge + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->github.com/go-i2p/go-i2p/lib/util.CheckFileAge + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Panic + + +Panic + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size->(*github.com/sirupsen/logrus.Logger).Panic + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).cacheFilePath->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Path + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Path + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).cacheFilePath + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).RecalculateSize->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Exists + + +Exists + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Exists->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Path + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Create + + +Create + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Create->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Path + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Create->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Create->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Create->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Create->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).CheckFilePathValid + + +CheckFilePathValid + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).CheckFilePathValid->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).CheckFilePathValid->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Ensure + + +Ensure + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Ensure->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Exists + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Ensure->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Create + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Ensure->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/netdb/reseed/doc.md b/lib/netdb/reseed/doc.md index 61bae77..8d89d1c 100644 --- a/lib/netdb/reseed/doc.md +++ b/lib/netdb/reseed/doc.md @@ -25,3 +25,40 @@ type Reseed struct { ```go func (r Reseed) SingleReseed(uri string) ([]router_info.RouterInfo, error) ``` + +# reseed +-- + import "github.com/go-i2p/go-i2p/lib/netdb/reseed" + + + +![reseed.svg](reseed) + +## Usage + +```go +const ( + I2pUserAgent = "Wget/1.11.4" +) +``` + +#### type Reseed + +```go +type Reseed struct { + net.Dialer +} +``` + + +#### func (Reseed) SingleReseed + +```go +func (r Reseed) SingleReseed(uri string) ([]router_info.RouterInfo, error) +``` + + + +reseed + +github.com/go-i2p/go-i2p/lib/netdb/reseed diff --git a/lib/netdb/reseed/reseed.svg b/lib/netdb/reseed/reseed.svg new file mode 100644 index 0000000..81a2bde --- /dev/null +++ b/lib/netdb/reseed/reseed.svg @@ -0,0 +1,394 @@ + + + + + + +gocallvis + + +cluster_focus + +reseed + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/su3 + + +su3 + + + + +cluster_*github.com/go-i2p/go-i2p/lib/su3.SU3 + + +(*SU3) + + + + +cluster_github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed + + +(Reseed) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info + + +router_info + + + + +cluster_github.com/eyedeekay/go-unzip/pkg/unzip + + +unzip + + + + +cluster_github.com/eyedeekay/go-unzip/pkg/unzip.Unzip + + +(Unzip) + + + + + +github.com/go-i2p/go-i2p/lib/netdb/reseed.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/netdb/reseed.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/eyedeekay/go-unzip/pkg/unzip.New + + +New + + + + + +(github.com/eyedeekay/go-unzip/pkg/unzip.Unzip).Extract + + +Extract + + + + + +github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo + + +ReadRouterInfo + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed + + +SingleReseed + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->github.com/eyedeekay/go-unzip/pkg/unzip.New + + + + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(github.com/eyedeekay/go-unzip/pkg/unzip.Unzip).Extract + + + + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->github.com/go-i2p/go-i2p/lib/common/router_info.ReadRouterInfo + + + + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read + + +Read + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->github.com/go-i2p/go-i2p/lib/su3.Read + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.SU3).Content + + +Content + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/go-i2p/go-i2p/lib/su3.SU3).Content + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.SU3).Signature + + +Signature + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/go-i2p/go-i2p/lib/su3.SU3).Signature + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Println + + +Println + + + + + +(github.com/go-i2p/go-i2p/lib/netdb/reseed.Reseed).SingleReseed->(*github.com/sirupsen/logrus.Logger).Println + + + + + + + + diff --git a/lib/router/doc.md b/lib/router/doc.md index 7cada2d..4a34d6e 100644 --- a/lib/router/doc.md +++ b/lib/router/doc.md @@ -9,6 +9,10 @@ ```go type Router struct { + // keystore for router info + *keys.RouterInfoKeystore + // multi-transport manager + *transport.TransportMuxer } ``` @@ -17,9 +21,9 @@ i2p router type #### func CreateRouter ```go -func CreateRouter() (r *Router, err error) +func CreateRouter(cfg *config.RouterConfig) (*Router, error) ``` -create router with default configuration +CreateRouter creates a router with the provided configuration #### func FromConfig @@ -56,3 +60,75 @@ Stop starts stopping internal state of router func (r *Router) Wait() ``` Wait blocks until router is fully stopped + +# router +-- + import "github.com/go-i2p/go-i2p/lib/router" + + + +![router.svg](router) + +## Usage + +#### type Router + +```go +type Router struct { + // keystore for router info + *keys.RouterInfoKeystore + // multi-transport manager + *transport.TransportMuxer +} +``` + +i2p router type + +#### func CreateRouter + +```go +func CreateRouter(cfg *config.RouterConfig) (*Router, error) +``` +CreateRouter creates a router with the provided configuration + +#### func FromConfig + +```go +func FromConfig(c *config.RouterConfig) (r *Router, err error) +``` +create router from configuration + +#### func (*Router) Close + +```go +func (r *Router) Close() error +``` +Close closes any internal state and finallizes router resources so that nothing +can start up again + +#### func (*Router) Start + +```go +func (r *Router) Start() +``` +Start starts router mainloop + +#### func (*Router) Stop + +```go +func (r *Router) Stop() +``` +Stop starts stopping internal state of router + +#### func (*Router) Wait + +```go +func (r *Router) Wait() +``` +Wait blocks until router is fully stopped + + + +router + +github.com/go-i2p/go-i2p/lib/router diff --git a/lib/router/router.svg b/lib/router/router.svg new file mode 100644 index 0000000..fcbe78d --- /dev/null +++ b/lib/router/router.svg @@ -0,0 +1,680 @@ + + + + + + +gocallvis + + +cluster_focus + +router + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/transport/ntcp + + +ntcp + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport + + +(*NTCP2Transport) + + + + +cluster_github.com/go-i2p/go-i2p/lib/transport + + +transport + + + + +cluster_github.com/go-i2p/go-i2p/lib/netdb + + +netdb + + + + +cluster_*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB + + +(*StdNetDB) + + + + +cluster_github.com/go-i2p/go-i2p/lib/keys + + +keys + + + + +cluster_*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore + + +(*RouterInfoKeystore) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info + + +router_info + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(*RouterInfo) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/base32 + + +base32 + + + + +cluster_*github.com/go-i2p/go-i2p/lib/router.Router + + +(*Router) + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter + + +CreateRouter + + + + + +github.com/go-i2p/go-i2p/lib/router.FromConfig + + +FromConfig + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->github.com/go-i2p/go-i2p/lib/router.FromConfig + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/base32.EncodeToString + + +EncodeToString + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->github.com/go-i2p/go-i2p/lib/common/base32.EncodeToString + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).AddAddress + + +AddAddress + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).AddAddress + + + + + + + + +github.com/go-i2p/go-i2p/lib/keys.NewRouterInfoKeystore + + +NewRouterInfoKeystore + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->github.com/go-i2p/go-i2p/lib/keys.NewRouterInfoKeystore + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).StoreKeys + + +StoreKeys + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).StoreKeys + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).GetKeys + + +GetKeys + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).GetKeys + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo + + +ConstructRouterInfo + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/go-i2p/go-i2p/lib/keys.RouterInfoKeystore).ConstructRouterInfo + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport.Mux + + +Mux + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->github.com/go-i2p/go-i2p/lib/transport.Mux + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Transport + + +NewNTCP2Transport + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Transport + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Address + + +Address + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Address + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/router.CreateRouter->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/router.FromConfig->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +github.com/go-i2p/go-i2p/lib/router.FromConfig->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/router.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/router.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Start + + +Start + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop + + +mainloop + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Start->(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop + + + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Start->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Start->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Start->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Stop + + +Stop + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/go-i2p/lib/router.Router).Stop + + + + + + + + +github.com/go-i2p/go-i2p/lib/netdb.NewStdNetDB + + +NewStdNetDB + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->github.com/go-i2p/go-i2p/lib/netdb.NewStdNetDB + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Ensure + + +Ensure + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Ensure + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size + + +Size + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/go-i2p/lib/netdb.StdNetDB).Size + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).mainloop->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Stop->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Close + + +Close + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Close->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Wait + + +Wait + + + + + +(*github.com/go-i2p/go-i2p/lib/router.Router).Wait->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/su3/doc.md b/lib/su3/doc.md index 7d315f4..016bdcb 100644 --- a/lib/su3/doc.md +++ b/lib/su3/doc.md @@ -72,29 +72,29 @@ an error. For clarification, see TestReadSignatureFirst. ```go var ( - ErrMissingMagicBytes = errors.New("missing magic bytes") - ErrMissingUnusedByte6 = errors.New("missing unused byte 6") - ErrMissingFileFormatVersion = errors.New("missing or incorrect file format version") - ErrMissingSignatureType = errors.New("missing or invalid signature type") - ErrUnsupportedSignatureType = errors.New("unsupported signature type") - ErrMissingSignatureLength = errors.New("missing signature length") - ErrMissingUnusedByte12 = errors.New("missing unused byte 12") - ErrMissingVersionLength = errors.New("missing version length") - ErrVersionTooShort = errors.New("version length too short") - ErrMissingUnusedByte14 = errors.New("missing unused byte 14") - ErrMissingSignerIDLength = errors.New("missing signer ID length") - ErrMissingContentLength = errors.New("missing content length") - ErrMissingUnusedByte24 = errors.New("missing unused byte 24") - ErrMissingFileType = errors.New("missing or invalid file type") - ErrMissingUnusedByte26 = errors.New("missing unused byte 26") - ErrMissingContentType = errors.New("missing or invalid content type") - ErrMissingUnusedBytes28To39 = errors.New("missing unused bytes 28-39") - ErrMissingVersion = errors.New("missing version") - ErrMissingSignerID = errors.New("missing signer ID") - ErrMissingContent = errors.New("missing content") - ErrMissingSignature = errors.New("missing signature") - ErrInvalidPublicKey = errors.New("invalid public key") - ErrInvalidSignature = errors.New("invalid signature") + ErrMissingMagicBytes = oops.Errorf("missing magic bytes") + ErrMissingUnusedByte6 = oops.Errorf("missing unused byte 6") + ErrMissingFileFormatVersion = oops.Errorf("missing or incorrect file format version") + ErrMissingSignatureType = oops.Errorf("missing or invalid signature type") + ErrUnsupportedSignatureType = oops.Errorf("unsupported signature type") + ErrMissingSignatureLength = oops.Errorf("missing signature length") + ErrMissingUnusedByte12 = oops.Errorf("missing unused byte 12") + ErrMissingVersionLength = oops.Errorf("missing version length") + ErrVersionTooShort = oops.Errorf("version length too short") + ErrMissingUnusedByte14 = oops.Errorf("missing unused byte 14") + ErrMissingSignerIDLength = oops.Errorf("missing signer ID length") + ErrMissingContentLength = oops.Errorf("missing content length") + ErrMissingUnusedByte24 = oops.Errorf("missing unused byte 24") + ErrMissingFileType = oops.Errorf("missing or invalid file type") + ErrMissingUnusedByte26 = oops.Errorf("missing unused byte 26") + ErrMissingContentType = oops.Errorf("missing or invalid content type") + ErrMissingUnusedBytes28To39 = oops.Errorf("missing unused bytes 28-39") + ErrMissingVersion = oops.Errorf("missing version") + ErrMissingSignerID = oops.Errorf("missing signer ID") + ErrMissingContent = oops.Errorf("missing content") + ErrMissingSignature = oops.Errorf("missing signature") + ErrInvalidPublicKey = oops.Errorf("invalid public key") + ErrInvalidSignature = oops.Errorf("invalid signature") ) ``` @@ -187,3 +187,201 @@ const ( EdDSA_SHA512_Ed25519ph SignatureType = "EdDSA-SHA512-Ed25519ph" ) ``` + +# su3 +-- + import "github.com/go-i2p/go-i2p/lib/su3" + +Package su3 implements reading the SU3 file format. + +SU3 files provide content that is signed by a known identity. They are used to +distribute many types of data, including reseed files, plugins, blocklists, and +more. + +See: https://geti2p.net/spec/updates#su3-file-specification + +The Read() function takes an io.Reader, and it returns a *SU3. The *SU3 contains +the SU3 file metadata, such as the type of the content and the signer ID. In +order to get the file contents, one must pass in the public key associated with +the file's signer, so that the signature can be validated. The content can still +be read without passing in the key, but after returning the full content the +error ErrInvalidSignature will be returned. + +Example usage: + + // Let's say we are reading an SU3 file from an HTTP body, which is an io.Reader. + su3File, err := su3.Read(body) + if err != nil { + // Handle error. + } + // Look up this signer's key. + key := somehow_lookup_the_key(su3File.SignerID) + // Read the content. + contentReader := su3File.Content(key) + bytes, err := ioutil.ReadAll(contentReader) + if errors.Is(err, su3.ErrInvalidSignature) { + // The signature is invalid, OR a nil key was provided. + } else if err != nil { + // Handle error. + } + +If you want to parse from a []byte, you can wrap it like this: + + mySU3FileBytes := []byte{0x00, 0x01, 0x02, 0x03} + su3File, err := su3.Read(bytes.NewReader(mySU3FileBytes)) + +One of the advantages of this library's design is that you can avoid buffering +the file contents in memory. Here's how you would stream from an HTTP body +directly to disk: + + su3File, err := su3.Read(body) + if err != nil { + // Handle error. + } + // Look up this signer's key. + key := somehow_lookup_the_key(su3File.SignerID) + // Stream directly to disk. + f, err := os.Create("my_file.txt") + if err != nil { + // Handle error. + } + _, err := io.Copy(f, su3File.Content(key)) + if errors.Is(err, su3.ErrInvalidSignature) { + // The signature is invalid, OR a nil key was provided. + // Don't trust the file, delete it! + } else if err != nil { + // Handle error. + } + +Note: if you want to read the content, the Content() io.Reader must be read +*before* the Signature() io.Reader. If you read the signature first, the content +bytes will be thrown away. If you then attempt to read the content, you will get +an error. For clarification, see TestReadSignatureFirst. + +![su3.svg](su3) + +## Usage + +```go +var ( + ErrMissingMagicBytes = oops.Errorf("missing magic bytes") + ErrMissingUnusedByte6 = oops.Errorf("missing unused byte 6") + ErrMissingFileFormatVersion = oops.Errorf("missing or incorrect file format version") + ErrMissingSignatureType = oops.Errorf("missing or invalid signature type") + ErrUnsupportedSignatureType = oops.Errorf("unsupported signature type") + ErrMissingSignatureLength = oops.Errorf("missing signature length") + ErrMissingUnusedByte12 = oops.Errorf("missing unused byte 12") + ErrMissingVersionLength = oops.Errorf("missing version length") + ErrVersionTooShort = oops.Errorf("version length too short") + ErrMissingUnusedByte14 = oops.Errorf("missing unused byte 14") + ErrMissingSignerIDLength = oops.Errorf("missing signer ID length") + ErrMissingContentLength = oops.Errorf("missing content length") + ErrMissingUnusedByte24 = oops.Errorf("missing unused byte 24") + ErrMissingFileType = oops.Errorf("missing or invalid file type") + ErrMissingUnusedByte26 = oops.Errorf("missing unused byte 26") + ErrMissingContentType = oops.Errorf("missing or invalid content type") + ErrMissingUnusedBytes28To39 = oops.Errorf("missing unused bytes 28-39") + ErrMissingVersion = oops.Errorf("missing version") + ErrMissingSignerID = oops.Errorf("missing signer ID") + ErrMissingContent = oops.Errorf("missing content") + ErrMissingSignature = oops.Errorf("missing signature") + ErrInvalidPublicKey = oops.Errorf("invalid public key") + ErrInvalidSignature = oops.Errorf("invalid signature") +) +``` + +#### type ContentType + +```go +type ContentType string +``` + + +```go +const ( + UNKNOWN ContentType = "unknown" + ROUTER_UPDATE ContentType = "router_update" + PLUGIN ContentType = "plugin" + RESEED ContentType = "reseed" + NEWS ContentType = "news" + BLOCKLIST ContentType = "blocklist" +) +``` + +#### type FileType + +```go +type FileType string +``` + + +```go +const ( + ZIP FileType = "zip" + XML FileType = "xml" + HTML FileType = "html" + XML_GZIP FileType = "xml.gz" + TXT_GZIP FileType = "txt.gz" + DMG FileType = "dmg" + EXE FileType = "exe" +) +``` + +#### type SU3 + +```go +type SU3 struct { + SignatureType SignatureType + SignatureLength uint16 + ContentLength uint64 + FileType FileType + ContentType ContentType + Version string + SignerID string +} +``` + + +#### func Read + +```go +func Read(reader io.Reader) (su3 *SU3, err error) +``` + +#### func (*SU3) Content + +```go +func (su3 *SU3) Content(publicKey interface{}) io.Reader +``` + +#### func (*SU3) Signature + +```go +func (su3 *SU3) Signature() io.Reader +``` + +#### type SignatureType + +```go +type SignatureType string +``` + + +```go +const ( + DSA_SHA1 SignatureType = "DSA-SHA1" + ECDSA_SHA256_P256 SignatureType = "ECDSA-SHA256-P256" + ECDSA_SHA384_P384 SignatureType = "ECDSA-SHA384-P384" + ECDSA_SHA512_P521 SignatureType = "ECDSA-SHA512-P521" + RSA_SHA256_2048 SignatureType = "RSA-SHA256-2048" + RSA_SHA384_3072 SignatureType = "RSA-SHA384-3072" + RSA_SHA512_4096 SignatureType = "RSA-SHA512-4096" + EdDSA_SHA512_Ed25519ph SignatureType = "EdDSA-SHA512-Ed25519ph" +) +``` + + + +su3 + +github.com/go-i2p/go-i2p/lib/su3 diff --git a/lib/su3/su3.svg b/lib/su3/su3.svg new file mode 100644 index 0000000..ce8dbe6 --- /dev/null +++ b/lib/su3/su3.svg @@ -0,0 +1,522 @@ + + + + + + +gocallvis + + +cluster_focus + +su3 + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/su3.signatureReader + + +(*signatureReader) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/su3.fixedLengthReader + + +(*fixedLengthReader) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/su3.contentReader + + +(*contentReader) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/su3.SU3 + + +(*SU3) + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read + + +Read + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/su3.Read->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/su3.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/su3.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/su3.init->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.SU3).Signature + + +Signature + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.SU3).Signature->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.SU3).Content + + +Content + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.SU3).Content->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.SU3).Content->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read + + +Read + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.fixedLengthReader).Read + + +Read + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->(*github.com/go-i2p/go-i2p/lib/su3.fixedLengthReader).Read + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes + + +getBytes + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.contentReader).Read->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.fixedLengthReader).Read->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.fixedLengthReader).Read->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).Read + + +Read + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).Read->(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).getBytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).Read->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).Read->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).Read->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/su3.signatureReader).Read->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/transport/doc.md b/lib/transport/doc.md index c3269c1..2eee2d5 100644 --- a/lib/transport/doc.md +++ b/lib/transport/doc.md @@ -9,7 +9,7 @@ ## Usage ```go -var ErrNoTransportAvailable = errors.New("no transports available") +var ErrNoTransportAvailable = oops.Errorf("no transports available") ``` error for when we have no transports available to use @@ -27,7 +27,7 @@ type Transport interface { // will bind if the underlying socket is not already // if the underlying socket is already bound update the RouterIdentity // returns any errors that happen if they do - SetIdentity(ident router_identity.RouterIdentity) error + SetIdentity(ident router_info.RouterInfo) error // Obtain a transport session with a router given its RouterInfo. // If a session with this router is NOT already made attempt to create one and block until made or until an error happens @@ -77,7 +77,7 @@ close every transport that this transport muxer has ```go func (tmux *TransportMuxer) Compatible(routerInfo router_info.RouterInfo) (compat bool) ``` -is there a transport that we mux that is compatible with this router info? +is there a transport that we mux that is compatable with this router info? #### func (*TransportMuxer) GetSession @@ -97,7 +97,7 @@ the name of this transport with the names of all the ones that we mux #### func (*TransportMuxer) SetIdentity ```go -func (tmux *TransportMuxer) SetIdentity(ident router_identity.RouterIdentity) (err error) +func (tmux *TransportMuxer) SetIdentity(ident router_info.RouterInfo) (err error) ``` set the identity for every transport @@ -120,3 +120,134 @@ type TransportSession interface { ``` a session between 2 routers for tranmitting i2np messages securly + +# transport +-- + import "github.com/go-i2p/go-i2p/lib/transport" + +* + + i2np messages transports + +![transport.svg](transport) + +## Usage + +```go +var ErrNoTransportAvailable = oops.Errorf("no transports available") +``` +error for when we have no transports available to use + +#### type Transport + +```go +type Transport interface { + // Accept accepts an incoming session. + Accept() (net.Conn, error) + + // Addr returns an + Addr() net.Addr + + // Set the router identity for this transport. + // will bind if the underlying socket is not already + // if the underlying socket is already bound update the RouterIdentity + // returns any errors that happen if they do + SetIdentity(ident router_info.RouterInfo) error + + // Obtain a transport session with a router given its RouterInfo. + // If a session with this router is NOT already made attempt to create one and block until made or until an error happens + // returns an established TransportSession and nil on success + // returns nil and an error on error + GetSession(routerInfo router_info.RouterInfo) (TransportSession, error) + + // return true if a routerInfo is compatible with this transport + Compatible(routerInfo router_info.RouterInfo) bool + + // close the transport cleanly + // blocks until done + // returns an error if one happens + Close() error + + // get the name of this tranport as a string + Name() string +} +``` + + +#### type TransportMuxer + +```go +type TransportMuxer struct { +} +``` + +muxes multiple transports into 1 Transport implements transport.Transport + +#### func Mux + +```go +func Mux(t ...Transport) (tmux *TransportMuxer) +``` +mux a bunch of transports together + +#### func (*TransportMuxer) Close + +```go +func (tmux *TransportMuxer) Close() (err error) +``` +close every transport that this transport muxer has + +#### func (*TransportMuxer) Compatible + +```go +func (tmux *TransportMuxer) Compatible(routerInfo router_info.RouterInfo) (compat bool) +``` +is there a transport that we mux that is compatable with this router info? + +#### func (*TransportMuxer) GetSession + +```go +func (tmux *TransportMuxer) GetSession(routerInfo router_info.RouterInfo) (s TransportSession, err error) +``` +get a transport session given a router info return session and nil if successful +return nil and ErrNoTransportAvailable if we failed to get a session + +#### func (*TransportMuxer) Name + +```go +func (tmux *TransportMuxer) Name() string +``` +the name of this transport with the names of all the ones that we mux + +#### func (*TransportMuxer) SetIdentity + +```go +func (tmux *TransportMuxer) SetIdentity(ident router_info.RouterInfo) (err error) +``` +set the identity for every transport + +#### type TransportSession + +```go +type TransportSession interface { + // queue an i2np message to be sent over the session + // will block as long as the send queue is full + // does not block if the queue is not full + QueueSendI2NP(msg i2np.I2NPMessage) + // return how many i2np messages are not completely sent yet + SendQueueSize() int + // blocking read the next fully recv'd i2np message from this session + ReadNextI2NP() (i2np.I2NPMessage, error) + // close the session cleanly + // returns any errors that happen while closing the session + Close() error +} +``` + +a session between 2 routers for tranmitting i2np messages securly + + + +transport + +github.com/go-i2p/go-i2p/lib/transport diff --git a/lib/transport/messages/doc.md b/lib/transport/messages/doc.md index f83c2d7..8e661c5 100644 --- a/lib/transport/messages/doc.md +++ b/lib/transport/messages/doc.md @@ -66,3 +66,81 @@ PayloadSize returns the message payload size func (sr *SessionRequest) Type() MessageType ``` Type returns the message type + +# ntcp +-- + import "github.com/go-i2p/go-i2p/lib/transport/messages" + + + +![ntcp.svg](ntcp) + +## Usage + +```go +const ( + MessageTypeSessionRequest = 0x00 + MessageTypeSessionCreated = 0x01 + MessageTypeSessionConfirmed = 0x02 + MessageTypeData = 0x03 +) +``` + +#### type Message + +```go +type Message interface { + // Type returns the message type + Type() MessageType + // Payload returns the message payload + Payload() []byte + // PayloadSize returns the message payload size + PayloadSize() int +} +``` + + +#### type MessageType + +```go +type MessageType uint8 +``` + + +#### type SessionRequest + +```go +type SessionRequest struct { + XContent []byte // 32-byte X value + + Padding []byte // padding of message 1 +} +``` + + +#### func (*SessionRequest) Payload + +```go +func (sr *SessionRequest) Payload() []byte +``` +Payload returns the message payload + +#### func (*SessionRequest) PayloadSize + +```go +func (sr *SessionRequest) PayloadSize() int +``` +PayloadSize returns the message payload size + +#### func (*SessionRequest) Type + +```go +func (sr *SessionRequest) Type() MessageType +``` +Type returns the message type + + + +ntcp + +github.com/go-i2p/go-i2p/lib/transport/messages diff --git a/lib/transport/messages/ntcp.svg b/lib/transport/messages/ntcp.svg new file mode 100644 index 0000000..947c327 --- /dev/null +++ b/lib/transport/messages/ntcp.svg @@ -0,0 +1,13 @@ + + + + + + +gocallvis + + + diff --git a/lib/transport/noise/doc.md b/lib/transport/noise/doc.md index 348df1a..3745a1a 100644 --- a/lib/transport/noise/doc.md +++ b/lib/transport/noise/doc.md @@ -1,300 +1,646 @@ - # noise - -## Overview - -The `noise` package implements the Noise Protocol to establish secure, authenticated sessions over TCP. This package includes functions for session management, handshake initiation, packet encryption, decryption, and transport abstraction. +-- + import "github.com/go-i2p/go-i2p/lib/transport/noise" -- [handshake.go](#handshakego) -- [i2np.go](#i2npgo) -- [incoming_handshake.go](#incoming_handshakego) -- [outgoing_handshake.go](#outgoing_handshakego) -- [noise_constants.go](#noise_constantsgo) -- [read_session.go](#read_sessiongo) -- [session.go](#sessiongo) -- [transport.go](#transportgo) -- [write_session.go](#write_sessiongo) - ---- - -## handshake.go - -Defines the `Handshake` function, which initiates the Noise handshake process for secure, authenticated sessions. - -### Package +## Usage ```go -package noise -``` +const ( + NOISE_DH_CURVE25519 = 1 -### Imports + NOISE_CIPHER_CHACHAPOLY = 1 + NOISE_CIPHER_AESGCM = 2 -```go -import ( - "sync" - "github.com/go-i2p/go-i2p/lib/util/logger" - "github.com/go-i2p/go-i2p/lib/common/router_info" + NOISE_HASH_SHA256 = 3 + + NOISE_PATTERN_XK = 11 + + MaxPayloadSize = 65537 ) ``` -### Variables - -- **`log`**: Logger instance for capturing debug and error messages related to the handshake process. - -### Function: `Handshake` - -#### Definition - ```go -func (c *NoiseTransport) Handshake(routerInfo router_info.RouterInfo) error +const NOISE_PROTOCOL_NAME = "NOISE" ``` -#### Parameters -- `routerInfo`: Information about the router with which the handshake is established. - -#### Returns -- `error`: Returns `nil` on success, or an error if the handshake fails. - -#### Description -The `Handshake` function initiates an authenticated handshake with a router, establishing a secure session. - -#### Workflow -1. **Logging Start**: Logs initiation of the handshake. -2. **Lock Mutex**: Locks `c.Mutex` to prevent concurrent access. -3. **Session Retrieval**: Calls `c.getSession(routerInfo)`. -4. **Condition Variable Setup**: Sets a `Cond` for the session. -5. **Outgoing Handshake**: Executes `RunOutgoingHandshake`. -6. **Completion Broadcast**: Broadcasts to waiting goroutines. -7. **Finalize and Unlock**: Logs success. - ---- - -## i2np.go - -Provides functions to queue and send I2NP messages using a `NoiseSession`. - -### Package +```go +var ExampleNoiseListener net.Listener = exampleNoiseTransport +``` +ExampleNoiseListener is not a real Noise Listener, do not use it. It is exported +so that it can be confirmed that the transport implements net.Listener ```go -package noise +var ( + ExampleNoiseSession net.Conn = exampleNoiseSession.(*NoiseSession) +) ``` -### Imports +#### func NewNoiseTransportSession ```go -import "github.com/go-i2p/go-i2p/lib/i2np" +func NewNoiseTransportSession(ri router_info.RouterInfo) (transport.TransportSession, error) ``` -### Functions +#### type HandshakeState -#### `QueueSendI2NP` +```go +type HandshakeState struct { + *noise.HandshakeState +} +``` -Queues an I2NP message for sending. + +#### func NewHandshakeState + +```go +func NewHandshakeState(staticKey noise.DHKey, isInitiator bool) (*HandshakeState, error) +``` + +#### func (*HandshakeState) GenerateEphemeral + +```go +func (h *HandshakeState) GenerateEphemeral() (*noise.DHKey, error) +``` +GenerateEphemeral creates the ephemeral keypair that will be used in handshake +This needs to be separate so NTCP2 can obfuscate it + +#### func (*HandshakeState) ReadMessage + +```go +func (h *HandshakeState) ReadMessage(message []byte) ([]byte, *noise.CipherState, *noise.CipherState, error) +``` + +#### func (*HandshakeState) SetEphemeral + +```go +func (h *HandshakeState) SetEphemeral(key *noise.DHKey) error +``` +SetEphemeral allows setting a potentially modified ephemeral key This is needed +for NTCP2's obfuscation layer + +#### func (*HandshakeState) WriteMessage + +```go +func (h *HandshakeState) WriteMessage(payload []byte) ([]byte, *noise.CipherState, *noise.CipherState, error) +``` + +#### type NoiseSession + +```go +type NoiseSession struct { + router_info.RouterInfo + *noise.CipherState + *sync.Cond + *NoiseTransport // The parent transport, which "Dialed" the connection to the peer with whom we established the session + *HandshakeState + RecvQueue *cb.Queue + SendQueue *cb.Queue + VerifyCallback VerifyCallbackFunc + + Conn net.Conn +} +``` + + +#### func NewNoiseSession + +```go +func NewNoiseSession(ri router_info.RouterInfo) (*NoiseSession, error) +``` + +#### func (*NoiseSession) Close + +```go +func (s *NoiseSession) Close() error +``` + +#### func (*NoiseSession) ComposeInitiatorHandshakeMessage + +```go +func (c *NoiseSession) ComposeInitiatorHandshakeMessage( + payload []byte, + ephemeralPrivate []byte, +) ( + negotiationData, + handshakeMessage []byte, + handshakeState *noise.HandshakeState, + err error, +) +``` + +#### func (*NoiseSession) ComposeReceiverHandshakeMessage + +```go +func (c *NoiseSession) ComposeReceiverHandshakeMessage(localStatic noise.DHKey, remoteStatic []byte, payload []byte, ephemeralPrivate []byte) (negData, msg []byte, state *noise.HandshakeState, err error) +``` + +#### func (*NoiseSession) LocalAddr + +```go +func (s *NoiseSession) LocalAddr() net.Addr +``` + +#### func (*NoiseSession) QueueSendI2NP ```go func (s *NoiseSession) QueueSendI2NP(msg i2np.I2NPMessage) ``` -#### Parameters -- `msg`: The I2NP message. - ---- - -#### `SendQueueSize` - -Returns the size of the send queue. - -```go -func (s *NoiseSession) SendQueueSize() int -``` - ---- - -#### `ReadNextI2NP` - -Attempts to read the next I2NP message from the queue. - -```go -func (s *NoiseSession) ReadNextI2NP() (i2np.I2NPMessage, error) -``` - ---- - -## incoming_handshake.go - -Defines functions for the incoming (receiver) side of the handshake. - -### Functions - -#### `ComposeReceiverHandshakeMessage` - -Creates a receiver handshake message using Noise patterns. - -```go -func ComposeReceiverHandshakeMessage(s noise.DHKey, rs []byte, payload []byte, ePrivate []byte) (negData, msg []byte, state *noise.HandshakeState, err error) -``` - -- **`s`**: Static Diffie-Hellman key. -- **`rs`**: Remote static key. -- **`payload`**: Optional payload data. -- **`ePrivate`**: Private ephemeral key. - ---- - -#### `RunIncomingHandshake` - -Executes an incoming handshake process. - -```go -func (c *NoiseSession) RunIncomingHandshake() error -``` - -- Initializes and sends the negotiation data and handshake message. - ---- - -## outgoing_handshake.go - -Defines functions for the outgoing (initiator) side of the handshake. - -### Functions - -#### `ComposeInitiatorHandshakeMessage` - -Creates an initiator handshake message. - -```go -func ComposeInitiatorHandshakeMessage(s noise.DHKey, rs []byte, payload []byte, ePrivate []byte) (negData, msg []byte, state *noise.HandshakeState, err error) -``` - ---- - -#### `RunOutgoingHandshake` - -Executes the outgoing handshake process. - -```go -func (c *NoiseSession) RunOutgoingHandshake() error -``` - -- Sends negotiation data and handshake message. - ---- - -## noise_constants.go - -Defines constants and utility functions for configuring Noise protocol parameters. - -### Constants - -```go -const ( - NOISE_DH_CURVE25519 = 1 - NOISE_CIPHER_CHACHAPOLY = 1 - NOISE_HASH_SHA256 = 3 - NOISE_PATTERN_XK = 11 - uint16Size = 2 - MaxPayloadSize = 65537 -) -``` - -### Functions - -#### `initNegotiationData` - -Initializes negotiation data with default values. - -```go -func initNegotiationData(negotiationData []byte) []byte -``` - ---- - -## read_session.go - -Functions related to reading encrypted data in a Noise session. - -### Functions - -#### `Read` - -Reads from the Noise session. +#### func (*NoiseSession) Read ```go func (c *NoiseSession) Read(b []byte) (int, error) ``` -#### `decryptPacket` - -Decrypts a packet. +#### func (*NoiseSession) ReadNextI2NP ```go -func (c *NoiseSession) decryptPacket(data []byte) (int, []byte, error) +func (s *NoiseSession) ReadNextI2NP() (i2np.I2NPMessage, error) ``` ---- - -## session.go - -Defines the `NoiseSession` struct and associated methods for session management. - -### Struct: `NoiseSession` - -Defines session properties. +#### func (*NoiseSession) RemoteAddr ```go -type NoiseSession struct { - // Session properties here -} +func (noise_session *NoiseSession) RemoteAddr() net.Addr ``` +RemoteAddr implements net.Conn ---- - -## transport.go - -Defines the `NoiseTransport` struct and its methods for session compatibility, accepting connections, etc. - -### Struct: `NoiseTransport` +#### func (*NoiseSession) RunIncomingHandshake ```go -type NoiseTransport struct { - sync.Mutex - router_identity.RouterIdentity - *noise.CipherState - Listener net.Listener - peerConnections map[data.Hash]transport.TransportSession -} +func (c *NoiseSession) RunIncomingHandshake() error ``` -#### Methods +#### func (*NoiseSession) RunOutgoingHandshake -- `Compatible`: Checks compatibility. -- `Accept`: Accepts a connection. -- `Addr`: Returns the address. -- `SetIdentity`: Sets the router identity. -- `GetSession`: Obtains a session. +```go +func (c *NoiseSession) RunOutgoingHandshake() error +``` ---- +#### func (*NoiseSession) SendQueueSize -## write_session.go +```go +func (s *NoiseSession) SendQueueSize() int +``` -Functions for writing encrypted data in a Noise session. +#### func (*NoiseSession) SetDeadline -### Functions +```go +func (noise_session *NoiseSession) SetDeadline(t time.Time) error +``` +SetDeadline implements net.Conn -#### `Write` +#### func (*NoiseSession) SetReadDeadline -Writes data in a Noise session. +```go +func (noise_session *NoiseSession) SetReadDeadline(t time.Time) error +``` +SetReadDeadline implements net.Conn + +#### func (*NoiseSession) SetWriteDeadline + +```go +func (noise_session *NoiseSession) SetWriteDeadline(t time.Time) error +``` +SetWriteDeadline implements net.Conn + +#### func (*NoiseSession) Write ```go func (c *NoiseSession) Write(b []byte) (int, error) ``` -#### `encryptPacket` - -Encrypts a packet. +#### type NoiseTransport ```go -func (c *NoiseSession) encryptPacket(data []byte) (int, []byte, error) -``` \ No newline at end of file +type NoiseTransport struct { + sync.Mutex + router_info.RouterInfo + + Listener net.Listener +} +``` + + +#### func NewNoiseTransport + +```go +func NewNoiseTransport(netSocket net.Listener) *NoiseTransport +``` +NewNoiseTransport create a NoiseTransport using a supplied net.Listener + +#### func NewNoiseTransportSocket + +```go +func NewNoiseTransportSocket() (*NoiseTransport, error) +``` +NewNoiseTransportSocket creates a Noise transport socket with a random host and +port. + +#### func (*NoiseTransport) Accept + +```go +func (noopt *NoiseTransport) Accept() (net.Conn, error) +``` +Accept a connection on a listening socket. + +#### func (*NoiseTransport) Addr + +```go +func (noopt *NoiseTransport) Addr() net.Addr +``` +Addr of the transport, for now this is returning the IP:Port the transport is +listening on, but this might actually be the router identity + +#### func (*NoiseTransport) Close + +```go +func (noopt *NoiseTransport) Close() error +``` +close the transport cleanly blocks until done returns an error if one happens + +#### func (*NoiseTransport) Compatable + +```go +func (noopt *NoiseTransport) Compatable(routerInfo router_info.RouterInfo) bool +``` +Compatable return true if a routerInfo is compatable with this transport + +#### func (*NoiseTransport) Compatible + +```go +func (noopt *NoiseTransport) Compatible(routerInfo router_info.RouterInfo) bool +``` + +#### func (*NoiseTransport) GetSession + +```go +func (noopt *NoiseTransport) GetSession(routerInfo router_info.RouterInfo) (transport.TransportSession, error) +``` +Obtain a transport session with a router given its RouterInfo. If a session with +this router is NOT already made attempt to create one and block until made or +until an error happens returns an established TransportSession and nil on +success returns nil and an error on error + +#### func (*NoiseTransport) Handshake + +```go +func (c *NoiseTransport) Handshake(routerInfo router_info.RouterInfo) error +``` + +#### func (*NoiseTransport) HandshakeKey + +```go +func (h *NoiseTransport) HandshakeKey() *noise.DHKey +``` + +#### func (*NoiseTransport) Name + +```go +func (noopt *NoiseTransport) Name() string +``` +Name of the transport TYPE, in this case `noise` + +#### func (*NoiseTransport) SetIdentity + +```go +func (noopt *NoiseTransport) SetIdentity(ident router_info.RouterInfo) (err error) +``` +SetIdentity will set the router identity for this transport. will bind if the +underlying socket is not already if the underlying socket is already bound +update the RouterIdentity returns any errors that happen if they do + +#### type VerifyCallbackFunc + +```go +type VerifyCallbackFunc func(publicKey []byte, data []byte) error +``` + +# noise +-- + import "github.com/go-i2p/go-i2p/lib/transport/noise" + + + +![noise.svg](noise) + +## Usage + +```go +const ( + NOISE_DH_CURVE25519 = 1 + + NOISE_CIPHER_CHACHAPOLY = 1 + NOISE_CIPHER_AESGCM = 2 + + NOISE_HASH_SHA256 = 3 + + NOISE_PATTERN_XK = 11 + + MaxPayloadSize = 65537 +) +``` + +```go +const NOISE_PROTOCOL_NAME = "NOISE" +``` + +```go +var ExampleNoiseListener net.Listener = exampleNoiseTransport +``` +ExampleNoiseListener is not a real Noise Listener, do not use it. It is exported +so that it can be confirmed that the transport implements net.Listener + +```go +var ( + ExampleNoiseSession net.Conn = exampleNoiseSession.(*NoiseSession) +) +``` + +#### func NewNoiseTransportSession + +```go +func NewNoiseTransportSession(ri router_info.RouterInfo) (transport.TransportSession, error) +``` + +#### type HandshakeState + +```go +type HandshakeState struct { + *noise.HandshakeState +} +``` + + +#### func NewHandshakeState + +```go +func NewHandshakeState(staticKey noise.DHKey, isInitiator bool) (*HandshakeState, error) +``` + +#### func (*HandshakeState) GenerateEphemeral + +```go +func (h *HandshakeState) GenerateEphemeral() (*noise.DHKey, error) +``` +GenerateEphemeral creates the ephemeral keypair that will be used in handshake +This needs to be separate so NTCP2 can obfuscate it + +#### func (*HandshakeState) ReadMessage + +```go +func (h *HandshakeState) ReadMessage(message []byte) ([]byte, *noise.CipherState, *noise.CipherState, error) +``` + +#### func (*HandshakeState) SetEphemeral + +```go +func (h *HandshakeState) SetEphemeral(key *noise.DHKey) error +``` +SetEphemeral allows setting a potentially modified ephemeral key This is needed +for NTCP2's obfuscation layer + +#### func (*HandshakeState) WriteMessage + +```go +func (h *HandshakeState) WriteMessage(payload []byte) ([]byte, *noise.CipherState, *noise.CipherState, error) +``` + +#### type NoiseSession + +```go +type NoiseSession struct { + router_info.RouterInfo + *noise.CipherState + *sync.Cond + *NoiseTransport // The parent transport, which "Dialed" the connection to the peer with whom we established the session + *HandshakeState + RecvQueue *cb.Queue + SendQueue *cb.Queue + VerifyCallback VerifyCallbackFunc + + Conn net.Conn +} +``` + + +#### func NewNoiseSession + +```go +func NewNoiseSession(ri router_info.RouterInfo) (*NoiseSession, error) +``` + +#### func (*NoiseSession) Close + +```go +func (s *NoiseSession) Close() error +``` + +#### func (*NoiseSession) ComposeInitiatorHandshakeMessage + +```go +func (c *NoiseSession) ComposeInitiatorHandshakeMessage( + payload []byte, + ephemeralPrivate []byte, +) ( + negotiationData, + handshakeMessage []byte, + handshakeState *noise.HandshakeState, + err error, +) +``` + +#### func (*NoiseSession) ComposeReceiverHandshakeMessage + +```go +func (c *NoiseSession) ComposeReceiverHandshakeMessage(localStatic noise.DHKey, remoteStatic []byte, payload []byte, ephemeralPrivate []byte) (negData, msg []byte, state *noise.HandshakeState, err error) +``` + +#### func (*NoiseSession) LocalAddr + +```go +func (s *NoiseSession) LocalAddr() net.Addr +``` + +#### func (*NoiseSession) QueueSendI2NP + +```go +func (s *NoiseSession) QueueSendI2NP(msg i2np.I2NPMessage) +``` + +#### func (*NoiseSession) Read + +```go +func (c *NoiseSession) Read(b []byte) (int, error) +``` + +#### func (*NoiseSession) ReadNextI2NP + +```go +func (s *NoiseSession) ReadNextI2NP() (i2np.I2NPMessage, error) +``` + +#### func (*NoiseSession) RemoteAddr + +```go +func (noise_session *NoiseSession) RemoteAddr() net.Addr +``` +RemoteAddr implements net.Conn + +#### func (*NoiseSession) RunIncomingHandshake + +```go +func (c *NoiseSession) RunIncomingHandshake() error +``` + +#### func (*NoiseSession) RunOutgoingHandshake + +```go +func (c *NoiseSession) RunOutgoingHandshake() error +``` + +#### func (*NoiseSession) SendQueueSize + +```go +func (s *NoiseSession) SendQueueSize() int +``` + +#### func (*NoiseSession) SetDeadline + +```go +func (noise_session *NoiseSession) SetDeadline(t time.Time) error +``` +SetDeadline implements net.Conn + +#### func (*NoiseSession) SetReadDeadline + +```go +func (noise_session *NoiseSession) SetReadDeadline(t time.Time) error +``` +SetReadDeadline implements net.Conn + +#### func (*NoiseSession) SetWriteDeadline + +```go +func (noise_session *NoiseSession) SetWriteDeadline(t time.Time) error +``` +SetWriteDeadline implements net.Conn + +#### func (*NoiseSession) Write + +```go +func (c *NoiseSession) Write(b []byte) (int, error) +``` + +#### type NoiseTransport + +```go +type NoiseTransport struct { + sync.Mutex + router_info.RouterInfo + + Listener net.Listener +} +``` + + +#### func NewNoiseTransport + +```go +func NewNoiseTransport(netSocket net.Listener) *NoiseTransport +``` +NewNoiseTransport create a NoiseTransport using a supplied net.Listener + +#### func NewNoiseTransportSocket + +```go +func NewNoiseTransportSocket() (*NoiseTransport, error) +``` +NewNoiseTransportSocket creates a Noise transport socket with a random host and +port. + +#### func (*NoiseTransport) Accept + +```go +func (noopt *NoiseTransport) Accept() (net.Conn, error) +``` +Accept a connection on a listening socket. + +#### func (*NoiseTransport) Addr + +```go +func (noopt *NoiseTransport) Addr() net.Addr +``` +Addr of the transport, for now this is returning the IP:Port the transport is +listening on, but this might actually be the router identity + +#### func (*NoiseTransport) Close + +```go +func (noopt *NoiseTransport) Close() error +``` +close the transport cleanly blocks until done returns an error if one happens + +#### func (*NoiseTransport) Compatable + +```go +func (noopt *NoiseTransport) Compatable(routerInfo router_info.RouterInfo) bool +``` +Compatable return true if a routerInfo is compatable with this transport + +#### func (*NoiseTransport) Compatible + +```go +func (noopt *NoiseTransport) Compatible(routerInfo router_info.RouterInfo) bool +``` + +#### func (*NoiseTransport) GetSession + +```go +func (noopt *NoiseTransport) GetSession(routerInfo router_info.RouterInfo) (transport.TransportSession, error) +``` +Obtain a transport session with a router given its RouterInfo. If a session with +this router is NOT already made attempt to create one and block until made or +until an error happens returns an established TransportSession and nil on +success returns nil and an error on error + +#### func (*NoiseTransport) Handshake + +```go +func (c *NoiseTransport) Handshake(routerInfo router_info.RouterInfo) error +``` + +#### func (*NoiseTransport) HandshakeKey + +```go +func (h *NoiseTransport) HandshakeKey() *noise.DHKey +``` + +#### func (*NoiseTransport) Name + +```go +func (noopt *NoiseTransport) Name() string +``` +Name of the transport TYPE, in this case `noise` + +#### func (*NoiseTransport) SetIdentity + +```go +func (noopt *NoiseTransport) SetIdentity(ident router_info.RouterInfo) (err error) +``` +SetIdentity will set the router identity for this transport. will bind if the +underlying socket is not already if the underlying socket is already bound +update the RouterIdentity returns any errors that happen if they do + +#### type VerifyCallbackFunc + +```go +type VerifyCallbackFunc func(publicKey []byte, data []byte) error +``` + + + +noise + +github.com/go-i2p/go-i2p/lib/transport/noise diff --git a/lib/transport/noise/noise.svg b/lib/transport/noise/noise.svg new file mode 100644 index 0000000..23a588b --- /dev/null +++ b/lib/transport/noise/noise.svg @@ -0,0 +1,2374 @@ + + + + + + +gocallvis + + +cluster_focus + +noise + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info + + +router_info + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(RouterInfo) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(*RouterInfo) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address + + +router_address + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress + + +(RouterAddress) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.I2PString + + +(I2PString) + + + + +cluster_github.com/flynn/noise + + +noise + + + + +cluster_*github.com/flynn/noise.HandshakeState + + +(*HandshakeState) + + + + +cluster_*github.com/flynn/noise.CipherState + + +(*CipherState) + + + + +cluster_github.com/emirpasic/gods/queues/circularbuffer + + +circularbuffer + + + + +cluster_*github.com/emirpasic/gods/queues/circularbuffer.Queue + + +(*Queue) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport + + +(*NoiseTransport) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession + + +(*NoiseSession) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport/noise.HandshakeState + + +(*HandshakeState) + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.initNegotiationData + + +initNegotiationData + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession + + +NewNoiseTransportSession + + + + + +github.com/emirpasic/gods/queues/circularbuffer.New + + +New + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->github.com/emirpasic/gods/queues/circularbuffer.New + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes + + +Bytes + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).Bytes + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + +RouterAddresses + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + +String + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseSession + + +NewNoiseSession + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseSession->github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransport + + +NewNoiseTransport + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransport->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransport->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSocket + + +NewNoiseTransportSocket + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSocket->github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransport + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSocket->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSocket->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSocket->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSocket->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.newBlock + + +newBlock + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.newBlock->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.newBlock->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewHandshakeState + + +NewHandshakeState + + + + + +github.com/flynn/noise.NewCipherSuite + + +NewCipherSuite + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewHandshakeState->github.com/flynn/noise.NewCipherSuite + + + + + + + + +github.com/flynn/noise.NewHandshakeState + + +NewHandshakeState + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewHandshakeState->github.com/flynn/noise.NewHandshakeState + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.HandshakeState).ReadMessage + + +ReadMessage + + + + + +(*github.com/flynn/noise.HandshakeState).ReadMessage + + +ReadMessage + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.HandshakeState).ReadMessage->(*github.com/flynn/noise.HandshakeState).ReadMessage + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.HandshakeState).WriteMessage + + +WriteMessage + + + + + +(*github.com/flynn/noise.HandshakeState).WriteMessage + + +WriteMessage + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.HandshakeState).WriteMessage->(*github.com/flynn/noise.HandshakeState).WriteMessage + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetDeadline + + +SetDeadline + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetDeadline->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetDeadline->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake + + +RunOutgoingHandshake + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage + + +ComposeInitiatorHandshakeMessage + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write + + +Write + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Println + + +Println + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake->(*github.com/sirupsen/logrus.Logger).Println + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->github.com/go-i2p/go-i2p/lib/transport/noise.initNegotiationData + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticKey + + +peerStaticKey + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).HandshakeKey + + +HandshakeKey + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).HandshakeKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->github.com/flynn/noise.NewCipherSuite + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->github.com/flynn/noise.NewHandshakeState + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->(*github.com/flynn/noise.HandshakeState).WriteMessage + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeInitiatorHandshakeMessage->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + +Data + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticKey->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + +TransportStyle + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey + + +StaticKey + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticKey->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticKey->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked + + +writePacketLocked + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket + + +encryptPacket + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).writePacketLocked->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/flynn/noise.CipherState).Encrypt + + +Encrypt + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket->(*github.com/flynn/noise.CipherState).Encrypt + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).processCallback + + +processCallback + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).processCallback->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).processCallback->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).processCallback->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).processCallback->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).decryptPacket + + +decryptPacket + + + + + +(*github.com/flynn/noise.CipherState).Decrypt + + +Decrypt + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).decryptPacket->(*github.com/flynn/noise.CipherState).Decrypt + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).decryptPacket->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).decryptPacket->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).decryptPacket->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).decryptPacket->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).decryptPacket->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticIV + + +peerStaticIV + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticIV->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector + + +InitializationVector + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticIV->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).peerStaticIV->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetReadDeadline + + +SetReadDeadline + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetReadDeadline->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetReadDeadline->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RemoteAddr + + +RemoteAddr + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RemoteAddr->(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RemoteAddr->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RemoteAddr->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read + + +Read + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake + + +RunIncomingHandshake + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked + + +readPacketLocked + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Read->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Write + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage + + +ComposeReceiverHandshakeMessage + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).HandshakeKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunIncomingHandshake->(*github.com/sirupsen/logrus.Logger).Println + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->github.com/go-i2p/go-i2p/lib/transport/noise.initNegotiationData + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->github.com/flynn/noise.NewCipherSuite + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->github.com/flynn/noise.NewHandshakeState + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->(*github.com/flynn/noise.HandshakeState).WriteMessage + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).ComposeReceiverHandshakeMessage->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).encryptPacket + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).readPacketLocked->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).QueueSendI2NP + + +QueueSendI2NP + + + + + +(*github.com/emirpasic/gods/queues/circularbuffer.Queue).Enqueue + + +Enqueue + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).QueueSendI2NP->(*github.com/emirpasic/gods/queues/circularbuffer.Queue).Enqueue + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Close + + +Close + + + + + +(*github.com/emirpasic/gods/queues/circularbuffer.Queue).Clear + + +Clear + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Close->(*github.com/emirpasic/gods/queues/circularbuffer.Queue).Clear + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).Close->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetWriteDeadline + + +SetWriteDeadline + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetWriteDeadline->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SetWriteDeadline->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SendQueueSize + + +SendQueueSize + + + + + +(*github.com/emirpasic/gods/queues/circularbuffer.Queue).Size + + +Size + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).SendQueueSize->(*github.com/emirpasic/gods/queues/circularbuffer.Queue).Size + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).LocalAddr + + +LocalAddr + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).LocalAddr->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).LocalAddr->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Compatible + + +Compatible + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Compatible->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticIV + + +localStaticIV + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticIV->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticIV->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticIV->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Accept + + +Accept + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Accept->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Accept->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Accept->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Accept->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).SetIdentity + + +SetIdentity + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).SetIdentity->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).SetIdentity->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).SetIdentity->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).SetIdentity->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).SetIdentity->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake + + +Handshake + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseSession).RunOutgoingHandshake + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession + + +getSession + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash + + +IdentHash + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession + + +GetSession + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession->(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).getSession->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession->github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseSession + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).GetSession->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Compatable + + +Compatable + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Compatable->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).IdentHash + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Compatable->(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Compatable->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Compatable->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Addr + + +Addr + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Addr->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Addr->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Close + + +Close + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Close->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticKey + + +localStaticKey + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticKey->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticKey->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).localStaticKey->github.com/samber/oops.Errorf + + + + + + + + diff --git a/lib/transport/ntcp/doc.md b/lib/transport/ntcp/doc.md index 0d6fcc3..35e27e0 100644 --- a/lib/transport/ntcp/doc.md +++ b/lib/transport/ntcp/doc.md @@ -5,6 +5,21 @@ ## Usage +```go +const ( + NOISE_DH_CURVE25519 = 1 + + NOISE_CIPHER_CHACHAPOLY = 1 + NOISE_CIPHER_AESGCM = 2 + + NOISE_HASH_SHA256 = 3 + + NOISE_PATTERN_XK = 11 + + MaxPayloadSize = math.MaxUint16 - 16 - uint16Size /*data len*/ +) +``` + ```go const ( NTCP_PROTOCOL_VERSION = 2 @@ -13,18 +28,305 @@ const ( ) ``` -#### type Session +#### type NTCP2Session ```go -type Session struct{} +type NTCP2Session struct { + *noise.NoiseSession + *NTCP2Transport +} ``` -Session implements TransportSession An established transport session +NTCP2Session extends the base noise.NoiseSession with NTCP2-specific +functionality -#### type Transport +#### func NewNTCP2Session ```go -type Transport struct{} +func NewNTCP2Session(noiseConfig router_info.RouterInfo) (*NTCP2Session, error) +``` +NewNTCP2Session creates a new NTCP2 session using the existing noise +implementation + +#### func (*NTCP2Session) ComposeInitiatorHandshakeMessage + +```go +func (c *NTCP2Session) ComposeInitiatorHandshakeMessage( + localStatic noise.DHKey, + remoteStatic []byte, + payload []byte, + ephemeralPrivate []byte, +) ( + negotiationData, + handshakeMessage []byte, + handshakeState *noise.HandshakeState, + err error, +) +``` +Modify ComposeInitiatorHandshakeMessage in outgoing_handshake.go At the moment, +remoteStatic is stored in the NTCP2Session() and doesn't need to be passed as an +argument. You actually get it directly out of the remote RouterInfo, which the +NoiseSession also has access to. So maybe, the interface should change so that +we: + + - A: get the localStatic out of the parent NTCP2Transport's routerInfo, which is the "local" routerInfo + - B: get the remoteStatic out of the NTCP2Session router, which is the "remote" routerInfo + +#### func (*NTCP2Session) CreateSessionRequest + +```go +func (s *NTCP2Session) CreateSessionRequest() (*SessionRequest, error) ``` -Transport is an ntcp transport implementing transport.Transport interface +#### func (*NTCP2Session) DeobfuscateEphemeral + +```go +func (s *NTCP2Session) DeobfuscateEphemeral(obfuscatedEphemeralKey []byte) ([]byte, error) +``` +DeobfuscateEphemeral reverses the key obfuscation + +#### func (*NTCP2Session) ObfuscateEphemeral + +```go +func (s *NTCP2Session) ObfuscateEphemeral(ephemeralKey []byte) ([]byte, error) +``` +ObfuscateEphemeral implements NTCP2's key obfuscation using AES-256-CBC + +#### type NTCP2Transport + +```go +type NTCP2Transport struct { + *noise.NoiseTransport + *sntp.RouterTimestamper +} +``` + +NTCP2Transport is an ntcp2 transport implementing transport.NTCP2Transport +interface + +#### func NewNTCP2Transport + +```go +func NewNTCP2Transport(routerInfo *router_info.RouterInfo) (*NTCP2Transport, error) +``` + +#### func (*NTCP2Transport) Accept + +```go +func (t *NTCP2Transport) Accept() (net.Conn, error) +``` + +#### func (*NTCP2Transport) Address + +```go +func (t *NTCP2Transport) Address() (*router_address.RouterAddress, error) +``` + +#### func (*NTCP2Transport) Compatible + +```go +func (t *NTCP2Transport) Compatible(routerInfo router_info.RouterInfo) bool +``` + +#### func (*NTCP2Transport) GetSession + +```go +func (t *NTCP2Transport) GetSession(routerInfo router_info.RouterInfo) (transport.TransportSession, error) +``` + +#### func (*NTCP2Transport) Name + +```go +func (t *NTCP2Transport) Name() string +``` + +#### type PaddingStrategy + +```go +type PaddingStrategy interface { + AddPadding(message []byte) []byte + RemovePadding(message []byte) []byte +} +``` + + +#### type SessionRequest + +```go +type SessionRequest struct { + ObfuscatedKey []byte // 32 bytes + Timestamp uint32 // 4 bytes + Padding []byte // Random padding +} +``` + +# ntcp +-- + import "github.com/go-i2p/go-i2p/lib/transport/ntcp" + + + +![ntcp.svg](ntcp) + +## Usage + +```go +const ( + NOISE_DH_CURVE25519 = 1 + + NOISE_CIPHER_CHACHAPOLY = 1 + NOISE_CIPHER_AESGCM = 2 + + NOISE_HASH_SHA256 = 3 + + NOISE_PATTERN_XK = 11 + + MaxPayloadSize = math.MaxUint16 - 16 - uint16Size /*data len*/ +) +``` + +```go +const ( + NTCP_PROTOCOL_VERSION = 2 + NTCP_PROTOCOL_NAME = "NTCP2" + NTCP_MESSAGE_MAX_SIZE = 65537 +) +``` + +#### type NTCP2Session + +```go +type NTCP2Session struct { + *noise.NoiseSession + *NTCP2Transport +} +``` + +NTCP2Session extends the base noise.NoiseSession with NTCP2-specific +functionality + +#### func NewNTCP2Session + +```go +func NewNTCP2Session(noiseConfig router_info.RouterInfo) (*NTCP2Session, error) +``` +NewNTCP2Session creates a new NTCP2 session using the existing noise +implementation + +#### func (*NTCP2Session) ComposeInitiatorHandshakeMessage + +```go +func (c *NTCP2Session) ComposeInitiatorHandshakeMessage( + localStatic noise.DHKey, + remoteStatic []byte, + payload []byte, + ephemeralPrivate []byte, +) ( + negotiationData, + handshakeMessage []byte, + handshakeState *noise.HandshakeState, + err error, +) +``` +Modify ComposeInitiatorHandshakeMessage in outgoing_handshake.go At the moment, +remoteStatic is stored in the NTCP2Session() and doesn't need to be passed as an +argument. You actually get it directly out of the remote RouterInfo, which the +NoiseSession also has access to. So maybe, the interface should change so that +we: + + - A: get the localStatic out of the parent NTCP2Transport's routerInfo, which is the "local" routerInfo + - B: get the remoteStatic out of the NTCP2Session router, which is the "remote" routerInfo + +#### func (*NTCP2Session) CreateSessionRequest + +```go +func (s *NTCP2Session) CreateSessionRequest() (*SessionRequest, error) +``` + +#### func (*NTCP2Session) DeobfuscateEphemeral + +```go +func (s *NTCP2Session) DeobfuscateEphemeral(obfuscatedEphemeralKey []byte) ([]byte, error) +``` +DeobfuscateEphemeral reverses the key obfuscation + +#### func (*NTCP2Session) ObfuscateEphemeral + +```go +func (s *NTCP2Session) ObfuscateEphemeral(ephemeralKey []byte) ([]byte, error) +``` +ObfuscateEphemeral implements NTCP2's key obfuscation using AES-256-CBC + +#### type NTCP2Transport + +```go +type NTCP2Transport struct { + *noise.NoiseTransport + *sntp.RouterTimestamper +} +``` + +NTCP2Transport is an ntcp2 transport implementing transport.NTCP2Transport +interface + +#### func NewNTCP2Transport + +```go +func NewNTCP2Transport(routerInfo *router_info.RouterInfo) (*NTCP2Transport, error) +``` + +#### func (*NTCP2Transport) Accept + +```go +func (t *NTCP2Transport) Accept() (net.Conn, error) +``` + +#### func (*NTCP2Transport) Address + +```go +func (t *NTCP2Transport) Address() (*router_address.RouterAddress, error) +``` + +#### func (*NTCP2Transport) Compatible + +```go +func (t *NTCP2Transport) Compatible(routerInfo router_info.RouterInfo) bool +``` + +#### func (*NTCP2Transport) GetSession + +```go +func (t *NTCP2Transport) GetSession(routerInfo router_info.RouterInfo) (transport.TransportSession, error) +``` + +#### func (*NTCP2Transport) Name + +```go +func (t *NTCP2Transport) Name() string +``` + +#### type PaddingStrategy + +```go +type PaddingStrategy interface { + AddPadding(message []byte) []byte + RemovePadding(message []byte) []byte +} +``` + + +#### type SessionRequest + +```go +type SessionRequest struct { + ObfuscatedKey []byte // 32 bytes + Timestamp uint32 // 4 bytes + Padding []byte // Random padding +} +``` + + + +ntcp + +github.com/go-i2p/go-i2p/lib/transport/ntcp diff --git a/lib/transport/ntcp/ntcp.svg b/lib/transport/ntcp/ntcp.svg new file mode 100644 index 0000000..d240182 --- /dev/null +++ b/lib/transport/ntcp/ntcp.svg @@ -0,0 +1,918 @@ + + + + + + +gocallvis + + +cluster_focus + +ntcp + + +cluster_golang.org/x/exp/rand + + +rand + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_github.com/go-i2p/go-i2p/lib/util/time/sntp + + +sntp + + + + +cluster_*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper + + +(*RouterTimestamper) + + + + +cluster_github.com/go-i2p/go-i2p/lib/transport/obfs + + +obfs + + + + +cluster_github.com/go-i2p/go-i2p/lib/transport/noise + + +noise + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport + + +(*NoiseTransport) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info + + +router_info + + + + +cluster_*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(*RouterInfo) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address + + +router_address + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress + + +(RouterAddress) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.I2PString + + +(I2PString) + + + + +cluster_github.com/flynn/noise + + +noise + + + + +cluster_*github.com/flynn/noise.HandshakeState + + +(*HandshakeState) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport + + +(*NTCP2Transport) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session + + +(*NTCP2Session) + + + + + +github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Session + + +NewNTCP2Session + + + + + +github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession + + +NewNoiseTransportSession + + + + + +github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Session->github.com/go-i2p/go-i2p/lib/transport/noise.NewNoiseTransportSession + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/ntcp.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/transport/ntcp.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Transport + + +NewNTCP2Transport + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.NewRouterTimestamper + + +NewRouterTimestamper + + + + + +github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Transport->github.com/go-i2p/go-i2p/lib/util/time/sntp.NewRouterTimestamper + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).CreateSessionRequest + + +CreateSessionRequest + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ObfuscateEphemeral + + +ObfuscateEphemeral + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).CreateSessionRequest->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ObfuscateEphemeral + + + + + + + + +golang.org/x/exp/rand.Read + + +Read + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).CreateSessionRequest->golang.org/x/exp/rand.Read + + + + + + + + +golang.org/x/exp/rand.Intn + + +Intn + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).CreateSessionRequest->golang.org/x/exp/rand.Intn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey + + +peerStaticKey + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + +Data + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + +TransportStyle + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey + + +StaticKey + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + +RouterAddresses + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ObfuscateEphemeral->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV + + +peerStaticIV + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ObfuscateEphemeral->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/obfs.ObfuscateEphemeralKey + + +ObfuscateEphemeralKey + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ObfuscateEphemeral->github.com/go-i2p/go-i2p/lib/transport/obfs.ObfuscateEphemeralKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector + + +InitializationVector + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).DeobfuscateEphemeral + + +DeobfuscateEphemeral + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).DeobfuscateEphemeral->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).DeobfuscateEphemeral->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).peerStaticIV + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).DeobfuscateEphemeral->github.com/go-i2p/go-i2p/lib/transport/obfs.ObfuscateEphemeralKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ComposeInitiatorHandshakeMessage + + +ComposeInitiatorHandshakeMessage + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ComposeInitiatorHandshakeMessage->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).CreateSessionRequest + + + + + + + + +github.com/flynn/noise.NewCipherSuite + + +NewCipherSuite + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ComposeInitiatorHandshakeMessage->github.com/flynn/noise.NewCipherSuite + + + + + + + + +github.com/flynn/noise.NewHandshakeState + + +NewHandshakeState + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ComposeInitiatorHandshakeMessage->github.com/flynn/noise.NewHandshakeState + + + + + + + + +(*github.com/flynn/noise.HandshakeState).WriteMessage + + +WriteMessage + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Session).ComposeInitiatorHandshakeMessage->(*github.com/flynn/noise.HandshakeState).WriteMessage + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Accept + + +Accept + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Accept->github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Session + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Compatible + + +Compatible + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Accept->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Compatible + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Accept + + +Accept + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Accept->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Accept + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Accept->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Compatible->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Compatible->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Compatible->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticKey + + +localStaticKey + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticKey->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticKey->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).StaticKey + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticKey->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticKey->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticIV + + +localStaticIV + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticIV->(github.com/go-i2p/go-i2p/lib/common/data.I2PString).Data + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).TransportStyle + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticIV->(github.com/go-i2p/go-i2p/lib/common/router_address.RouterAddress).InitializationVector + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticIV->(*github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).RouterAddresses + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).localStaticIV->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).GetSession + + +GetSession + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).GetSession->github.com/go-i2p/go-i2p/lib/transport/ntcp.NewNTCP2Session + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake + + +Handshake + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).GetSession->(*github.com/go-i2p/go-i2p/lib/transport/noise.NoiseTransport).Handshake + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Address + + +Address + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Name + + +Name + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Address->(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Name + + + + + + + + +github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress + + +NewRouterAddress + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Address->github.com/go-i2p/go-i2p/lib/common/router_address.NewRouterAddress + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).GetCurrentTime + + +GetCurrentTime + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Address->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).GetCurrentTime + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport/ntcp.NTCP2Transport).Address->github.com/samber/oops.Errorf + + + + + + + + diff --git a/lib/transport/obfs/doc.md b/lib/transport/obfs/doc.md index cde5085..181f798 100644 --- a/lib/transport/obfs/doc.md +++ b/lib/transport/obfs/doc.md @@ -20,3 +20,35 @@ func ObfuscateEphemeralKey(message []byte, aesKey *crypto.AESSymmetricKey) ([]by ``` ObfuscateEphemeralKey encrypts the ephemeral public key in the message using AES-256-CBC without padding + +# obfs +-- + import "github.com/go-i2p/go-i2p/lib/transport/obfs" + + + +![obfs.svg](obfs) + +## Usage + +#### func DeobfuscateEphemeralKey + +```go +func DeobfuscateEphemeralKey(message []byte, aesKey *crypto.AESSymmetricKey) ([]byte, error) +``` +DeobfuscateEphemeralKey decrypts the ephemeral public key in the message using +AES-256-CBC without padding + +#### func ObfuscateEphemeralKey + +```go +func ObfuscateEphemeralKey(message []byte, aesKey *crypto.AESSymmetricKey) ([]byte, error) +``` +ObfuscateEphemeralKey encrypts the ephemeral public key in the message using +AES-256-CBC without padding + + + +obfs + +github.com/go-i2p/go-i2p/lib/transport/obfs diff --git a/lib/transport/obfs/obfs.svg b/lib/transport/obfs/obfs.svg new file mode 100644 index 0000000..e56b804 --- /dev/null +++ b/lib/transport/obfs/obfs.svg @@ -0,0 +1,131 @@ + + + + + + +gocallvis + + +cluster_focus + +obfs + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/go-i2p/lib/crypto + + +crypto + + + + +cluster_*github.com/go-i2p/go-i2p/lib/crypto.AESSymmetricEncrypter + + +(*AESSymmetricEncrypter) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/crypto.AESSymmetricDecrypter + + +(*AESSymmetricDecrypter) + + + + + +github.com/go-i2p/go-i2p/lib/transport/obfs.ObfuscateEphemeralKey + + +ObfuscateEphemeralKey + + + + + +(*github.com/go-i2p/go-i2p/lib/crypto.AESSymmetricEncrypter).EncryptNoPadding + + +EncryptNoPadding + + + + + +github.com/go-i2p/go-i2p/lib/transport/obfs.ObfuscateEphemeralKey->(*github.com/go-i2p/go-i2p/lib/crypto.AESSymmetricEncrypter).EncryptNoPadding + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/transport/obfs.ObfuscateEphemeralKey->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/obfs.DeobfuscateEphemeralKey + + +DeobfuscateEphemeralKey + + + + + +(*github.com/go-i2p/go-i2p/lib/crypto.AESSymmetricDecrypter).DecryptNoPadding + + +DecryptNoPadding + + + + + +github.com/go-i2p/go-i2p/lib/transport/obfs.DeobfuscateEphemeralKey->(*github.com/go-i2p/go-i2p/lib/crypto.AESSymmetricDecrypter).DecryptNoPadding + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport/obfs.DeobfuscateEphemeralKey->github.com/samber/oops.Errorf + + + + + + + + diff --git a/lib/transport/ssu/doc.md b/lib/transport/ssu/doc.md index 0200ebb..83094c1 100644 --- a/lib/transport/ssu/doc.md +++ b/lib/transport/ssu/doc.md @@ -5,3 +5,19 @@ i2p ssu transport implementation ## Usage + +# ssu +-- + import "github.com/go-i2p/go-i2p/lib/transport/ssu" + +i2p ssu transport implementation + +![ssu.svg](ssu) + +## Usage + + + +ssu + +github.com/go-i2p/go-i2p/lib/transport/ssu diff --git a/lib/transport/ssu/ssu.svg b/lib/transport/ssu/ssu.svg new file mode 100644 index 0000000..947c327 --- /dev/null +++ b/lib/transport/ssu/ssu.svg @@ -0,0 +1,13 @@ + + + + + + +gocallvis + + + diff --git a/lib/transport/transport.svg b/lib/transport/transport.svg new file mode 100644 index 0000000..70dae22 --- /dev/null +++ b/lib/transport/transport.svg @@ -0,0 +1,424 @@ + + + + + + +gocallvis + + +cluster_focus + +transport + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info + + +router_info + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo + + +(RouterInfo) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer + + +(*TransportMuxer) + + + + + +github.com/go-i2p/go-i2p/lib/transport.Mux + + +Mux + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/transport.Mux->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/transport.Mux->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/transport.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/transport.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/transport.init->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Name + + +Name + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Name->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Name->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).SetIdentity + + +SetIdentity + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).SetIdentity->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).SetIdentity->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).SetIdentity->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).SetIdentity->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Close + + +Close + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Close->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Close->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Close->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Close->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).GetSession + + +GetSession + + + + + +(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + +String + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).GetSession->(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).GetSession->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).GetSession->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).GetSession->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).GetSession->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).GetSession->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Compatible + + +Compatible + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Compatible->(github.com/go-i2p/go-i2p/lib/common/router_info.RouterInfo).String + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Compatible->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/transport.TransportMuxer).Compatible->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/tunnel/doc.md b/lib/tunnel/doc.md index a993ddc..64cd2c2 100644 --- a/lib/tunnel/doc.md +++ b/lib/tunnel/doc.md @@ -257,3 +257,271 @@ a pool of tunnels which we have created ```go type TunnelID uint32 ``` + +# tunnel +-- + import "github.com/go-i2p/go-i2p/lib/tunnel" + +i2p garlic tunnel implementation + +![tunnel.svg](tunnel) + +## Usage + +```go +const ( + DT_LOCAL = iota + DT_TUNNEL + DT_ROUTER + DT_UNUSED +) +``` + +```go +const ( + FIRST_FRAGMENT = iota + FOLLOW_ON_FRAGMENT +) +``` + +```go +const ( + FLAG_SIZE = 1 + TUNNEL_ID_SIZE = 4 + HASH_SIZE = 32 + DELAY_SIZE = 1 + MESSAGE_ID_SIZE = 4 + EXTENDED_OPTIONS_MIN_SIZE = 2 + SIZE_FIELD_SIZE = 2 +) +``` + +#### type DecryptedTunnelMessage + +```go +type DecryptedTunnelMessage [1028]byte +``` + + +#### func (DecryptedTunnelMessage) Checksum + +```go +func (decrypted_tunnel_message DecryptedTunnelMessage) Checksum() crypto.TunnelIV +``` + +#### func (DecryptedTunnelMessage) DeliveryInstructionsWithFragments + +```go +func (decrypted_tunnel_message DecryptedTunnelMessage) DeliveryInstructionsWithFragments() []DeliveryInstructionsWithFragment +``` +Returns a slice of DeliveryInstructionWithFragment structures, which all of the +Delivery Instructions in the tunnel message and their corresponding +MessageFragment structures. + +#### func (DecryptedTunnelMessage) ID + +```go +func (decrypted_tunnel_message DecryptedTunnelMessage) ID() TunnelID +``` + +#### func (DecryptedTunnelMessage) IV + +```go +func (decrypted_tunnel_message DecryptedTunnelMessage) IV() crypto.TunnelIV +``` + +#### type DelayFactor + +```go +type DelayFactor byte +``` + + +#### type DeliveryInstructions + +```go +type DeliveryInstructions []byte +``` + + +#### func (DeliveryInstructions) Delay + +```go +func (delivery_instructions DeliveryInstructions) Delay() (delay_factor DelayFactor, err error) +``` +Return the DelayFactor if present and any errors encountered parsing the +DeliveryInstructions. + +#### func (DeliveryInstructions) DeliveryType + +```go +func (delivery_instructions DeliveryInstructions) DeliveryType() (byte, error) +``` +Return the delivery type for these DeliveryInstructions, can be of type +DT_LOCAL, DT_TUNNEL, DT_ROUTER, or DT_UNUSED. + +#### func (DeliveryInstructions) ExtendedOptions + +```go +func (delivery_instructions DeliveryInstructions) ExtendedOptions() (data []byte, err error) +``` +Return the Extended Options data if present, or an error if not present. +Extended Options in unimplemented in the Java router and the presence of +extended options will generate a warning. + +#### func (DeliveryInstructions) FragmentNumber + +```go +func (delivery_instructions DeliveryInstructions) FragmentNumber() (int, error) +``` +Read the integer stored in the 6-1 bits of a FOLLOW_ON_FRAGMENT's flag, +indicating the fragment number. + +#### func (DeliveryInstructions) FragmentSize + +```go +func (delivery_instructions DeliveryInstructions) FragmentSize() (frag_size uint16, err error) +``` +Return the size of the associated I2NP fragment and an error if the data is +unavailable. + +#### func (DeliveryInstructions) Fragmented + +```go +func (delivery_instructions DeliveryInstructions) Fragmented() (bool, error) +``` +Returns true if the Delivery Instructions are fragmented or false if the +following data contains the entire message + +#### func (DeliveryInstructions) HasDelay + +```go +func (delivery_instructions DeliveryInstructions) HasDelay() (bool, error) +``` +Check if the delay bit is set. This feature in unimplemented in the Java router. + +#### func (DeliveryInstructions) HasExtendedOptions + +```go +func (delivery_instructions DeliveryInstructions) HasExtendedOptions() (bool, error) +``` +Check if the extended options bit is set. This feature in unimplemented in the +Java router. + +#### func (DeliveryInstructions) HasHash + +```go +func (delivery_instructions DeliveryInstructions) HasHash() (bool, error) +``` + +#### func (DeliveryInstructions) HasTunnelID + +```go +func (delivery_instructions DeliveryInstructions) HasTunnelID() (bool, error) +``` +Check if the DeliveryInstructions is of type DT_TUNNEL. + +#### func (DeliveryInstructions) Hash + +```go +func (delivery_instructions DeliveryInstructions) Hash() (hash common.Hash, err error) +``` +Return the hash for these DeliveryInstructions, which varies by hash type. + + If the type is DT_TUNNEL, hash is the SHA256 of the gateway router, if + the type is DT_ROUTER it is the SHA256 of the router. + +#### func (DeliveryInstructions) LastFollowOnFragment + +```go +func (delivery_instructions DeliveryInstructions) LastFollowOnFragment() (bool, error) +``` +Read the value of the 0 bit of a FOLLOW_ON_FRAGMENT, which is set to 1 to +indicate the last fragment. + +#### func (DeliveryInstructions) MessageID + +```go +func (delivery_instructions DeliveryInstructions) MessageID() (msgid uint32, err error) +``` +Return the I2NP Message ID or 0 and an error if the data is not available for +this DeliveryInstructions. + +#### func (DeliveryInstructions) TunnelID + +```go +func (delivery_instructions DeliveryInstructions) TunnelID() (tunnel_id uint32, err error) +``` +Return the tunnel ID in this DeliveryInstructions or 0 and an error if the +DeliveryInstructions are not of type DT_TUNNEL. + +#### func (DeliveryInstructions) Type + +```go +func (delivery_instructions DeliveryInstructions) Type() (int, error) +``` +Return if the DeliveryInstructions are of type FIRST_FRAGMENT or +FOLLOW_ON_FRAGMENT. + +#### type DeliveryInstructionsWithFragment + +```go +type DeliveryInstructionsWithFragment struct { + DeliveryInstructions DeliveryInstructions + MessageFragment []byte +} +``` + + +#### type EncryptedTunnelMessage + +```go +type EncryptedTunnelMessage crypto.TunnelData +``` + + +#### func (EncryptedTunnelMessage) Data + +```go +func (tm EncryptedTunnelMessage) Data() crypto.TunnelIV +``` + +#### func (EncryptedTunnelMessage) ID + +```go +func (tm EncryptedTunnelMessage) ID() (tid TunnelID) +``` + +#### func (EncryptedTunnelMessage) IV + +```go +func (tm EncryptedTunnelMessage) IV() crypto.TunnelIV +``` + +#### type Participant + +```go +type Participant struct { +} +``` + + +#### type Pool + +```go +type Pool struct{} +``` + +a pool of tunnels which we have created + +#### type TunnelID + +```go +type TunnelID uint32 +``` + + + +tunnel + +github.com/go-i2p/go-i2p/lib/tunnel diff --git a/lib/tunnel/tunnel.svg b/lib/tunnel/tunnel.svg new file mode 100644 index 0000000..2aa7f58 --- /dev/null +++ b/lib/tunnel/tunnel.svg @@ -0,0 +1,1890 @@ + + + + + + +gocallvis + + +cluster_focus + +tunnel + + +cluster_github.com/sirupsen/logrus + + +logrus + + + + +cluster_*github.com/sirupsen/logrus.Logger + + +(*Logger) + + + + +cluster_github.com/samber/oops + + +oops + + + + +cluster_github.com/go-i2p/logger + + +logger + + + + +cluster_*github.com/go-i2p/logger.Logger + + +(*Logger) + + + + +cluster_github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions + + +(DeliveryInstructions) + + + + +cluster_github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage + + +(DecryptedTunnelMessage) + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data + + +data + + + + +cluster_github.com/go-i2p/go-i2p/lib/common/data.Integer + + +(Integer) + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.init + + +init + + + + + +github.com/go-i2p/logger.GetGoI2PLogger + + +GetGoI2PLogger + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.init->github.com/go-i2p/logger.GetGoI2PLogger + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID + + +maybeAppendMessageID + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + +DeliveryType + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay + + +HasDelay + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Fragmented + + +Fragmented + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Fragmented + + + + + + + + +(*github.com/go-i2p/logger.Logger).Error + + +Error + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/samber/oops.Errorf + + +Errorf + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID->github.com/samber/oops.Errorf + + + + + + + + +(*github.com/sirupsen/logrus.Logger).Debug + + +Debug + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendHash + + +maybeAppendHash + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendHash->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash + + +HasHash + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendHash->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendHash->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions + + +readDeliveryInstructions + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendMessageID + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendHash + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendTunnelID + + +maybeAppendTunnelID + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendTunnelID + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendDelay + + +maybeAppendDelay + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendDelay + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendExtendedOptions + + +maybeAppendExtendedOptions + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendExtendedOptions + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendSize + + +maybeAppendSize + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type + + +Type + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithError + + +WithError + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithFields + + +WithFields + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID + + +TunnelID + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendTunnelID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID + + +HasTunnelID + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendTunnelID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendTunnelID->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendTunnelID->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendTunnelID->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendDelay->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendDelay->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash + + +Hash + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendDelay->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendDelay->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + +Int + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendExtendedOptions->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index + + +extended_options_index + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendExtendedOptions->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index + + + + + + + + +(*github.com/go-i2p/logger.Logger).WithField + + +WithField + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendExtendedOptions->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendExtendedOptions->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendSize->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendSize->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendSize->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendSize->github.com/samber/oops.Errorf + + + + + + + + +github.com/go-i2p/go-i2p/lib/tunnel.maybeAppendSize->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).deliveryInstructionData + + +deliveryInstructionData + + + + + +(*github.com/go-i2p/logger.Logger).Warn + + +Warn + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).deliveryInstructionData->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).deliveryInstructionData->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).deliveryInstructionData->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).DeliveryInstructionsWithFragments + + +DeliveryInstructionsWithFragments + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).DeliveryInstructionsWithFragments->github.com/go-i2p/go-i2p/lib/tunnel.readDeliveryInstructions + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).DeliveryInstructionsWithFragments->(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).deliveryInstructionData + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize + + +FragmentSize + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).DeliveryInstructionsWithFragments->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).DeliveryInstructionsWithFragments->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DecryptedTunnelMessage).DeliveryInstructionsWithFragments->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index + + +fragment_size_index + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentSize->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID + + +MessageID + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions + + +HasExtendedOptions + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions + + +ExtendedOptions + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).fragment_size_index->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index + + +message_id_index + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Fragmented + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).message_id_index->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Fragmented->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Fragmented->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Fragmented->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Fragmented->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).ExtendedOptions->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).MessageID + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasExtendedOptions + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).extended_options_index->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).TunnelID->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasTunnelID->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasHash->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Hash->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber + + +FragmentNumber + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber->(github.com/go-i2p/go-i2p/lib/common/data.Integer).Int + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).FragmentNumber->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).LastFollowOnFragment + + +LastFollowOnFragment + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).LastFollowOnFragment->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Type + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).LastFollowOnFragment->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).LastFollowOnFragment->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).LastFollowOnFragment->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).LastFollowOnFragment->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).LastFollowOnFragment->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay + + +Delay + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).DeliveryType + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).HasDelay + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(*github.com/go-i2p/logger.Logger).Warn + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(*github.com/go-i2p/logger.Logger).WithField + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(*github.com/go-i2p/logger.Logger).Error + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(*github.com/go-i2p/logger.Logger).WithError + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(*github.com/go-i2p/logger.Logger).WithFields + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->github.com/samber/oops.Errorf + + + + + + + + +(github.com/go-i2p/go-i2p/lib/tunnel.DeliveryInstructions).Delay->(*github.com/sirupsen/logrus.Logger).Debug + + + + + + + + diff --git a/lib/util/doc.md b/lib/util/doc.md index 1380e22..15e9cd6 100644 --- a/lib/util/doc.md +++ b/lib/util/doc.md @@ -37,3 +37,52 @@ Panicf allows passing formated string to panic() ```go func RegisterCloser(c io.Closer) ``` + +# util +-- + import "github.com/go-i2p/go-i2p/lib/util" + + + +![util.svg](util) + +## Usage + +#### func CheckFileAge + +```go +func CheckFileAge(fpath string, maxAge int) bool +``` +Check if a file is more than maxAge minutes old returns false if + +#### func CheckFileExists + +```go +func CheckFileExists(fpath string) bool +``` +Check if a file exists and is readable etc returns false if not + +#### func CloseAll + +```go +func CloseAll() +``` + +#### func Panicf + +```go +func Panicf(format string, args ...interface{}) +``` +Panicf allows passing formated string to panic() + +#### func RegisterCloser + +```go +func RegisterCloser(c io.Closer) +``` + + + +util + +github.com/go-i2p/go-i2p/lib/util diff --git a/lib/util/signals/doc.md b/lib/util/signals/doc.md index 643aa0d..9604832 100644 --- a/lib/util/signals/doc.md +++ b/lib/util/signals/doc.md @@ -28,3 +28,43 @@ func RegisterReloadHandler(f Handler) ```go type Handler func() ``` + +# signals +-- + import "github.com/go-i2p/go-i2p/lib/util/signals" + + + +![signals.svg](signals) + +## Usage + +#### func Handle + +```go +func Handle() +``` + +#### func RegisterInterruptHandler + +```go +func RegisterInterruptHandler(f Handler) +``` + +#### func RegisterReloadHandler + +```go +func RegisterReloadHandler(f Handler) +``` + +#### type Handler + +```go +type Handler func() +``` + + + +signals + +github.com/go-i2p/go-i2p/lib/util/signals diff --git a/lib/util/signals/signals.svg b/lib/util/signals/signals.svg new file mode 100644 index 0000000..ec4e16c --- /dev/null +++ b/lib/util/signals/signals.svg @@ -0,0 +1,90 @@ + + + + + + +gocallvis + + +cluster_focus + +signals + + + +github.com/go-i2p/go-i2p/lib/util/signals.Handle + + +Handle + + + + + +github.com/go-i2p/go-i2p/lib/util/signals.handleReload + + +handleReload + + + + + +github.com/go-i2p/go-i2p/lib/util/signals.Handle->github.com/go-i2p/go-i2p/lib/util/signals.handleReload + + + + + + + + +github.com/go-i2p/go-i2p/lib/util/signals.handleInterrupted + + +handleInterrupted + + + + + +github.com/go-i2p/go-i2p/lib/util/signals.Handle->github.com/go-i2p/go-i2p/lib/util/signals.handleInterrupted + + + + + + + + +github.com/go-i2p/go-i2p/lib/util/signals.init + + +init + + + + + +github.com/go-i2p/go-i2p/lib/util/signals.init#1 + + +init#1 + + + + + +github.com/go-i2p/go-i2p/lib/util/signals.init->github.com/go-i2p/go-i2p/lib/util/signals.init#1 + + + + + + + + diff --git a/lib/util/time/sntp/doc.md b/lib/util/time/sntp/doc.md index 6b8224f..ef7c8b2 100644 --- a/lib/util/time/sntp/doc.md +++ b/lib/util/time/sntp/doc.md @@ -1,70 +1,57 @@ # sntp -- - import "github.com/go-i2p/go-i2p/lib/util/sntp" + import "github.com/go-i2p/go-i2p/lib/util/time/sntp" + ## Usage +#### type DefaultNTPClient + ```go -import "github.com/go-i2p/go-i2p/lib/util/sntp" +type DefaultNTPClient struct{} ``` -## Types -### type RouterTimestamper +#### func (*DefaultNTPClient) QueryWithOptions ```go -type RouterTimestamper struct { - servers []string - priorityServers [][]string - listeners []UpdateListener - queryFrequency time.Duration - concurringServers int - consecutiveFails int - disabled bool - initialized bool - wellSynced bool - isRunning bool - mutex sync.Mutex - zones *Zones - stopChan chan struct{} - waitGroup sync.WaitGroup - ntpClient NTPClient +func (c *DefaultNTPClient) QueryWithOptions(host string, options ntp.QueryOptions) (*ntp.Response, error) +``` + +#### type NTPClient + +```go +type NTPClient interface { + QueryWithOptions(host string, options ntp.QueryOptions) (*ntp.Response, error) } ``` -RouterTimestamper is responsible for querying NTP servers and managing time synchronization. -#### func NewRouterTimestamper +#### type RouterTimestamper + +```go +type RouterTimestamper struct { +} +``` + + +#### func NewRouterTimestamper ```go func NewRouterTimestamper(client NTPClient) *RouterTimestamper ``` -NewRouterTimestamper creates a new RouterTimestamper instance. - -#### func (*RouterTimestamper) Start - -```go -func (rt *RouterTimestamper) Start() -``` - -Start begins the time synchronization process. - -#### func (*RouterTimestamper) Stop - -```go -func (rt *RouterTimestamper) Stop() -``` - -Stop halts the time synchronization process. - #### func (*RouterTimestamper) AddListener ```go func (rt *RouterTimestamper) AddListener(listener UpdateListener) ``` -AddListener adds a new listener for time updates. +#### func (*RouterTimestamper) GetCurrentTime + +```go +func (rt *RouterTimestamper) GetCurrentTime() time.Time +``` #### func (*RouterTimestamper) RemoveListener @@ -72,15 +59,17 @@ AddListener adds a new listener for time updates. func (rt *RouterTimestamper) RemoveListener(listener UpdateListener) ``` -RemoveListener removes a listener from receiving time updates. - -#### func (*RouterTimestamper) WaitForInitialization +#### func (*RouterTimestamper) Start ```go -func (rt *RouterTimestamper) WaitForInitialization() +func (rt *RouterTimestamper) Start() ``` -WaitForInitialization blocks until the RouterTimestamper is initialized or a timeout occurs. +#### func (*RouterTimestamper) Stop + +```go +func (rt *RouterTimestamper) Stop() +``` #### func (*RouterTimestamper) TimestampNow @@ -88,41 +77,164 @@ WaitForInitialization blocks until the RouterTimestamper is initialized or a tim func (rt *RouterTimestamper) TimestampNow() ``` -TimestampNow triggers an immediate time synchronization. +#### func (*RouterTimestamper) WaitForInitialization -### type UpdateListener +```go +func (rt *RouterTimestamper) WaitForInitialization() +``` + +#### type UpdateListener ```go type UpdateListener interface { - SetNow(now time.Time, stratum uint8) + SetNow(now time.Time, stratum uint8) } ``` -UpdateListener is an interface that listeners must implement to receive time updates. +UpdateListener is an interface that listeners must implement to receive time +updates. -### type Zones +#### type Zones ```go type Zones struct { - countryToZone map[string]string - continentToZone map[string]string } ``` -Zones manages mappings between country codes, continent codes, and NTP zones. -#### func NewZones +#### func NewZones ```go func NewZones() *Zones ``` -NewZones creates a new Zones instance and initializes it with data. - #### func (*Zones) GetZone ```go func (z *Zones) GetZone(countryCode string) string ``` -GetZone returns the NTP zone for a given country code. \ No newline at end of file +# sntp +-- + import "github.com/go-i2p/go-i2p/lib/util/time/sntp" + + + +![sntp.svg](sntp) + +## Usage + +#### type DefaultNTPClient + +```go +type DefaultNTPClient struct{} +``` + + +#### func (*DefaultNTPClient) QueryWithOptions + +```go +func (c *DefaultNTPClient) QueryWithOptions(host string, options ntp.QueryOptions) (*ntp.Response, error) +``` + +#### type NTPClient + +```go +type NTPClient interface { + QueryWithOptions(host string, options ntp.QueryOptions) (*ntp.Response, error) +} +``` + + +#### type RouterTimestamper + +```go +type RouterTimestamper struct { +} +``` + + +#### func NewRouterTimestamper + +```go +func NewRouterTimestamper(client NTPClient) *RouterTimestamper +``` + +#### func (*RouterTimestamper) AddListener + +```go +func (rt *RouterTimestamper) AddListener(listener UpdateListener) +``` + +#### func (*RouterTimestamper) GetCurrentTime + +```go +func (rt *RouterTimestamper) GetCurrentTime() time.Time +``` + +#### func (*RouterTimestamper) RemoveListener + +```go +func (rt *RouterTimestamper) RemoveListener(listener UpdateListener) +``` + +#### func (*RouterTimestamper) Start + +```go +func (rt *RouterTimestamper) Start() +``` + +#### func (*RouterTimestamper) Stop + +```go +func (rt *RouterTimestamper) Stop() +``` + +#### func (*RouterTimestamper) TimestampNow + +```go +func (rt *RouterTimestamper) TimestampNow() +``` + +#### func (*RouterTimestamper) WaitForInitialization + +```go +func (rt *RouterTimestamper) WaitForInitialization() +``` + +#### type UpdateListener + +```go +type UpdateListener interface { + SetNow(now time.Time, stratum uint8) +} +``` + +UpdateListener is an interface that listeners must implement to receive time +updates. + +#### type Zones + +```go +type Zones struct { +} +``` + + +#### func NewZones + +```go +func NewZones() *Zones +``` + +#### func (*Zones) GetZone + +```go +func (z *Zones) GetZone(countryCode string) string +``` + + + +sntp + +github.com/go-i2p/go-i2p/lib/util/time/sntp diff --git a/lib/util/time/sntp/sntp.svg b/lib/util/time/sntp/sntp.svg new file mode 100644 index 0000000..8f2a941 --- /dev/null +++ b/lib/util/time/sntp/sntp.svg @@ -0,0 +1,414 @@ + + + + + + +gocallvis + + +cluster_focus + +sntp + + +cluster_github.com/beevik/ntp + + +ntp + + + + +cluster_*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones + + +(*Zones) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper + + +(*RouterTimestamper) + + + + +cluster_*github.com/go-i2p/go-i2p/lib/util/time/sntp.DefaultNTPClient + + +(*DefaultNTPClient) + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.getLocalCountryCode + + +getLocalCountryCode + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.checkIPv6Connectivity + + +checkIPv6Connectivity + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.absDuration + + +absDuration + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.NewZones + + +NewZones + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones).initialize + + +initialize + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.NewZones->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones).initialize + + + + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.NewRouterTimestamper + + +NewRouterTimestamper + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.NewRouterTimestamper->github.com/go-i2p/go-i2p/lib/util/time/sntp.NewZones + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).updateConfig + + +updateConfig + + + + + +github.com/go-i2p/go-i2p/lib/util/time/sntp.NewRouterTimestamper->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).updateConfig + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.DefaultNTPClient).QueryWithOptions + + +QueryWithOptions + + + + + +github.com/beevik/ntp.QueryWithOptions + + +QueryWithOptions + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.DefaultNTPClient).QueryWithOptions->github.com/beevik/ntp.QueryWithOptions + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).updateConfig->github.com/go-i2p/go-i2p/lib/util/time/sntp.getLocalCountryCode + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones).GetZone + + +GetZone + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).updateConfig->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones).GetZone + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).performTimeQuery + + +performTimeQuery + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).performTimeQuery->github.com/go-i2p/go-i2p/lib/util/time/sntp.checkIPv6Connectivity + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).performTimeQuery->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).updateConfig + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).queryTime + + +queryTime + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).performTimeQuery->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).queryTime + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).secureRandBool + + +secureRandBool + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).performTimeQuery->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).secureRandBool + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).queryTime->github.com/go-i2p/go-i2p/lib/util/time/sntp.absDuration + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).stampTime + + +stampTime + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).queryTime->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).stampTime + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).runOnce + + +runOnce + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).runOnce->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).performTimeQuery + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).TimestampNow + + +TimestampNow + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).TimestampNow->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).runOnce + + + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).GetCurrentTime + + +GetCurrentTime + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).GetCurrentTime->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).TimestampNow + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).validateResponse + + +validateResponse + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).validateResponse->github.com/go-i2p/go-i2p/lib/util/time/sntp.absDuration + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).run + + +run + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).run->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).performTimeQuery + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).Start + + +Start + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).Start->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.RouterTimestamper).run + + + + + + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones).readContinentFile + + +readContinentFile + + + + + +(*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones).initialize->(*github.com/go-i2p/go-i2p/lib/util/time/sntp.Zones).readContinentFile + + + + + + + + diff --git a/lib/util/util.svg b/lib/util/util.svg new file mode 100644 index 0000000..947c327 --- /dev/null +++ b/lib/util/util.svg @@ -0,0 +1,13 @@ + + + + + + +gocallvis + + +