Files
Go_I2p/lib/common/router_identity/router_identity.go

44 lines
1.3 KiB
Go
Raw Normal View History

2022-09-12 08:31:02 +00:00
// Package router_identity implements the I2P RouterIdentity common data structure
package router_identity
import (
. "github.com/go-i2p/go-i2p/lib/common/keys_and_cert"
)
2022-09-12 08:31:02 +00:00
/*
[RouterIdentity]
Accurate for version 0.9.49
2022-09-12 08:31:02 +00:00
Description
Defines the way to uniquely identify a particular router
2022-09-12 08:31:02 +00:00
Contents
Identical to KeysAndCert.
*/
2022-09-12 08:31:02 +00:00
// RouterIdentity is the represenation of an I2P RouterIdentity.
//
// https://geti2p.net/spec/common-structures#routeridentity
type RouterIdentity struct {
*KeysAndCert
}
2022-09-12 08:31:02 +00:00
// 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.
2016-02-15 00:34:29 -08:00
func ReadRouterIdentity(data []byte) (router_identity RouterIdentity, remainder []byte, err error) {
keys_and_cert, remainder, err := NewKeysAndCert(data)
router_identity = RouterIdentity{
2022-09-12 08:31:02 +00:00
keys_and_cert,
}
return
}
2022-09-12 08:31:02 +00:00
// NewRouterIdentity creates a new *RouterIdentity from []byte using ReadRouterIdentity.
// Returns a pointer to RouterIdentity unlike ReadRouterIdentity.
func NewRouterIdentity(data []byte) (router_identity *RouterIdentity, remainder []byte, err error) {
objrouter_identity, remainder, err := ReadRouterIdentity(data)
router_identity = &objrouter_identity
2016-02-15 00:34:29 -08:00
return
}