Files
go-i2p/lib/i2np/doc.md
2025-02-26 20:52:16 -05:00

11 KiB

i2np

-- import "github.com/go-i2p/go-i2p/lib/i2np"

Usage

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
)
var ERR_BUILD_REQUEST_RECORD_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np build request record data")
var ERR_I2NP_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np header data")

func ReadI2NPNTCPData

func ReadI2NPNTCPData(data []byte, size int) ([]byte, error)

func ReadI2NPNTCPMessageChecksum

func ReadI2NPNTCPMessageChecksum(data []byte) (int, error)

func ReadI2NPNTCPMessageExpiration

func ReadI2NPNTCPMessageExpiration(data []byte) (datalib.Date, error)

func ReadI2NPNTCPMessageID

func ReadI2NPNTCPMessageID(data []byte) (int, error)

func ReadI2NPNTCPMessageSize

func ReadI2NPNTCPMessageSize(data []byte) (int, error)

func ReadI2NPSSUMessageExpiration

func ReadI2NPSSUMessageExpiration(data []byte) (datalib.Date, error)

func ReadI2NPType

func ReadI2NPType(data []byte) (int, error)

type BuildRequestRecord

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

func ReadBuildRequestRecord(data []byte) (BuildRequestRecord, error)

type BuildRequestRecordElGamal

type BuildRequestRecordElGamal [528]byte

type BuildRequestRecordElGamalAES

type BuildRequestRecordElGamalAES [528]byte

type BuildResponseRecord

type BuildResponseRecord struct {
	Hash    common.Hash
	Padding [495]byte
	Reply   byte
}

type BuildResponseRecordELGamal

type BuildResponseRecordELGamal [528]byte

type BuildResponseRecordELGamalAES

type BuildResponseRecordELGamalAES [528]byte

type Data

type Data struct {
	Length int
	Data   []byte
}

type DatabaseLookup

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

type DatabaseSearchReply struct {
	Key        common.Hash
	Count      int
	PeerHashes []common.Hash
	From       common.Hash
}

type DatabaseStore

type DatabaseStore struct {
	Key           common.Hash
	Type          byte
	ReplyToken    [4]byte
	ReplyTunnelID [4]byte
	ReplyGateway  common.Hash
	Data          []byte
}

type DeliveryStatus

type DeliveryStatus struct {
	MessageID int
	Timestamp time.Time
}

type Garlic

type Garlic struct {
	Count       int
	Cloves      []GarlicClove
	Certificate certificate.Certificate
	MessageID   int
	Expiration  time.Time
}

type GarlicClove

type GarlicClove struct {
	DeliveryInstructions GarlicCloveDeliveryInstructions
	I2NPMessage          I2NPMessage
	CloveID              int
	Expiration           time.Time
	Certificate          certificate.Certificate
}

type GarlicCloveDeliveryInstructions

type GarlicCloveDeliveryInstructions struct {
	Flag       byte
	SessionKey session_key.SessionKey
	Hash       common.Hash
	TunnelID   tunnel.TunnelID
	Delay      int
}

type GarlicElGamal

type GarlicElGamal []byte

type I2NPMessage

type I2NPMessage []byte

type I2NPNTCPHeader

type I2NPNTCPHeader struct {
	Type       int
	MessageID  int
	Expiration time.Time
	Size       int
	Checksum   int
	Data       []byte
}

func ReadI2NPNTCPHeader

func ReadI2NPNTCPHeader(data []byte) (I2NPNTCPHeader, error)

Read an entire I2NP message and return the parsed header with embedded encrypted data

type I2NPSSUHeader

type I2NPSSUHeader struct {
	Type       int
	Expiration time.Time
}

func ReadI2NPSSUHeader

func ReadI2NPSSUHeader(data []byte) (I2NPSSUHeader, error)

type TunnelBuild

type TunnelBuild [8]BuildRequestRecord

type TunnelBuildReply

type TunnelBuildReply [8]BuildResponseRecord

type TunnelData

type TunnelData [1028]byte

type TunnelGatway

type TunnelGatway struct {
	TunnelID tunnel.TunnelID
	Length   int
	Data     []byte
}

type VariableTunnelBuild

type VariableTunnelBuild struct {
	Count               int
	BuildRequestRecords []BuildRequestRecord
}

type VariableTunnelBuildReply

type VariableTunnelBuildReply struct {
	Count                int
	BuildResponseRecords []BuildResponseRecord
}

i2np

-- import "github.com/go-i2p/go-i2p/lib/i2np"

i2np.svg

Usage

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
)
var ERR_BUILD_REQUEST_RECORD_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np build request record data")
var ERR_I2NP_NOT_ENOUGH_DATA = oops.Errorf("not enough i2np header data")

func ReadI2NPNTCPData

func ReadI2NPNTCPData(data []byte, size int) ([]byte, error)

func ReadI2NPNTCPMessageChecksum

func ReadI2NPNTCPMessageChecksum(data []byte) (int, error)

func ReadI2NPNTCPMessageExpiration

func ReadI2NPNTCPMessageExpiration(data []byte) (datalib.Date, error)

func ReadI2NPNTCPMessageID

func ReadI2NPNTCPMessageID(data []byte) (int, error)

func ReadI2NPNTCPMessageSize

func ReadI2NPNTCPMessageSize(data []byte) (int, error)

func ReadI2NPSSUMessageExpiration

func ReadI2NPSSUMessageExpiration(data []byte) (datalib.Date, error)

func ReadI2NPType

func ReadI2NPType(data []byte) (int, error)

type BuildRequestRecord

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

func ReadBuildRequestRecord(data []byte) (BuildRequestRecord, error)

type BuildRequestRecordElGamal

type BuildRequestRecordElGamal [528]byte

type BuildRequestRecordElGamalAES

type BuildRequestRecordElGamalAES [528]byte

type BuildResponseRecord

type BuildResponseRecord struct {
	Hash    common.Hash
	Padding [495]byte
	Reply   byte
}

type BuildResponseRecordELGamal

type BuildResponseRecordELGamal [528]byte

type BuildResponseRecordELGamalAES

type BuildResponseRecordELGamalAES [528]byte

type Data

type Data struct {
	Length int
	Data   []byte
}

type DatabaseLookup

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

type DatabaseSearchReply struct {
	Key        common.Hash
	Count      int
	PeerHashes []common.Hash
	From       common.Hash
}

type DatabaseStore

type DatabaseStore struct {
	Key           common.Hash
	Type          byte
	ReplyToken    [4]byte
	ReplyTunnelID [4]byte
	ReplyGateway  common.Hash
	Data          []byte
}

type DeliveryStatus

type DeliveryStatus struct {
	MessageID int
	Timestamp time.Time
}

type Garlic

type Garlic struct {
	Count       int
	Cloves      []GarlicClove
	Certificate certificate.Certificate
	MessageID   int
	Expiration  time.Time
}

type GarlicClove

type GarlicClove struct {
	DeliveryInstructions GarlicCloveDeliveryInstructions
	I2NPMessage          I2NPMessage
	CloveID              int
	Expiration           time.Time
	Certificate          certificate.Certificate
}

type GarlicCloveDeliveryInstructions

type GarlicCloveDeliveryInstructions struct {
	Flag       byte
	SessionKey session_key.SessionKey
	Hash       common.Hash
	TunnelID   tunnel.TunnelID
	Delay      int
}

type GarlicElGamal

type GarlicElGamal []byte

type I2NPMessage

type I2NPMessage []byte

type I2NPNTCPHeader

type I2NPNTCPHeader struct {
	Type       int
	MessageID  int
	Expiration time.Time
	Size       int
	Checksum   int
	Data       []byte
}

func ReadI2NPNTCPHeader

func ReadI2NPNTCPHeader(data []byte) (I2NPNTCPHeader, error)

Read an entire I2NP message and return the parsed header with embedded encrypted data

type I2NPSSUHeader

type I2NPSSUHeader struct {
	Type       int
	Expiration time.Time
}

func ReadI2NPSSUHeader

func ReadI2NPSSUHeader(data []byte) (I2NPSSUHeader, error)

type TunnelBuild

type TunnelBuild [8]BuildRequestRecord

type TunnelBuildReply

type TunnelBuildReply [8]BuildResponseRecord

type TunnelData

type TunnelData [1028]byte

type TunnelGatway

type TunnelGatway struct {
	TunnelID tunnel.TunnelID
	Length   int
	Data     []byte
}

type VariableTunnelBuild

type VariableTunnelBuild struct {
	Count               int
	BuildRequestRecords []BuildRequestRecord
}

type VariableTunnelBuildReply

type VariableTunnelBuildReply struct {
	Count                int
	BuildResponseRecords []BuildResponseRecord
}

i2np

github.com/go-i2p/go-i2p/lib/i2np