multiaddrsam

package module
v0.0.0-...-145a011 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MIT Imports: 5 Imported by: 1

README

sam3-multiaddr

Implements multiaddr-like type using sam3.I2PAddr on top of Multiaddr. It pretty much glues i2p compatibility on top of Multiaddr. This is probably not a good way to do this long term. Just for testing.

Documentation

Index

Constants

View Source
const GarlicNTCP = 445

GarlicNTCP indicates an i2p streaming connection

View Source
const GarlicSAM = 765

GarlicSAM indicates an i2p SAM connection

View Source
const GarlicSSU = 890

GarlicSSU indicates an i2p datagram connection

Variables

View Source
var GarlicVSAM []byte

GarlicVSAM stores the VCode of the connection

Functions

This section is empty.

Types

type I2PMultiaddr

type I2PMultiaddr struct {
	Name  string
	Code  int
	VCode []byte

	I2POnly bool

	sam3.I2PAddr
	// contains filtered or unexported fields
}

I2PMultiaddr is an i2p-enabled multiaddr, with both types(TCP-like and UDP-like) capabilities

func NewI2PMultiaddr

func NewI2PMultiaddr(protocol string, i2ponly bool, samaddr ...string) (I2PMultiaddr, error)

NewI2PMultiaddr creates a new i2p multiaddr, with a protocol string(ntcp, ssu) a switch for only being an i2p address, and an optional SAM Host/Port pair

func (I2PMultiaddr) Address

func (addr I2PMultiaddr) Address() *sam3.I2PAddr

Address converts the I2PMultiaddr into a sam3.I2PAddr which implements net.Addr

func (I2PMultiaddr) Bytes

func (addr I2PMultiaddr) Bytes() []byte

Bytes returns the whole address as a slice of bytes

func (I2PMultiaddr) Decapsulate

func (addr I2PMultiaddr) Decapsulate(multiaddr ma.Multiaddr) ma.Multiaddr

Decapsulate implements Multiaddr

func (I2PMultiaddr) Encapsulate

func (addr I2PMultiaddr) Encapsulate(multiaddr ma.Multiaddr) ma.Multiaddr

Encapsulate implements Multiaddr

func (I2PMultiaddr) Equal

func (addr I2PMultiaddr) Equal(multiaddr ma.Multiaddr) bool

Equal determines if two I2PMultiaddr's are equal by comparing the strings.

func (I2PMultiaddr) Protocols

func (addr I2PMultiaddr) Protocols() []ma.Protocol

Protocols implements Multiaddr

func (I2PMultiaddr) SAMAddress

func (addr I2PMultiaddr) SAMAddress() string

SAMAddress returns "/sam/SAMq Host:SAM Port" of the I2PMultiaddr as a string

func (I2PMultiaddr) SAMAddressString

func (addr I2PMultiaddr) SAMAddressString() string

SAMAddressString returns the SAM address as "SAM host:SAM port"

func (I2PMultiaddr) String

func (addr I2PMultiaddr) String() string

String returns the I2PMultiaddr as a string

func (I2PMultiaddr) ValueForProtocol

func (addr I2PMultiaddr) ValueForProtocol(code int) (string, error)

ValueForProtocol implements I2PMultiaddr

Jump to

Keyboard shortcuts

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