types

package
v0.0.0-...-11a4688 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2016 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Money

type Money interface {
	MakePayment(amount int64, destination string) (chan bool, error)
	GetNewAddress() (string, chan uint64, error)
}

This represents a payment engine, which produces signed payments on demand

type NodeAddress

type NodeAddress string

This represents a raw node address (not hex encoded for human consumption).

func (NodeAddress) MarshalText

func (n NodeAddress) MarshalText() ([]byte, error)

func (*NodeAddress) UnmarshalText

func (n *NodeAddress) UnmarshalText(b []byte) error

type Packet

type Packet struct {
	// This represents the node tht the packet should go to. Note that the NodeAddress is in fact a
	// public key hash.
	Dest NodeAddress
	// The Amt is the amount of money in satoshis that will be paid upon packet delivery.
	Amt int64
	// The data is the physical data which will be sent.
	Data []byte
}

This represents a basic packet.

func (Packet) Amount

func (p Packet) Amount() int64

func (Packet) Destination

func (p Packet) Destination() NodeAddress

func (Packet) Hash

func (p Packet) Hash() PacketHash

The PacketHash is a useful canonical representation of the packet.

func (Packet) String

func (p Packet) String() string

type PacketHash

type PacketHash string

This represents a canonical packet hash.

func (PacketHash) MarshalText

func (n PacketHash) MarshalText() ([]byte, error)

func (*PacketHash) UnmarshalText

func (n *PacketHash) UnmarshalText(b []byte) error

type TCPTunnelData

type TCPTunnelData struct {
	Data []byte
}

TCP tunneling response packet Data packet sent during normal transmission, after handshake

func (*TCPTunnelData) MarshalBinary

func (d *TCPTunnelData) MarshalBinary() ([]byte, error)

Returns the TCPTunnelData as a byte slice. Adds version number and message type

Version number is always 0 for now
Message type is 2 for TCPTunnelData

func (*TCPTunnelData) UnmarshalBinary

func (d *TCPTunnelData) UnmarshalBinary(data []byte) error

Takes byte slice from the wire and unmarshals it. Checks version is 0 and message type is TCPTunnelData (2) Rest of the data in the packet is the message data

type TCPTunnelRequest

type TCPTunnelRequest struct {
	Source NodeAddress
}

TCP tunneling request packet Client sends empty struct to request tunneling

func (*TCPTunnelRequest) MarshalBinary

func (req *TCPTunnelRequest) MarshalBinary() ([]byte, error)

Returns the TCPTunnelRequest as a byte slice. Adds version number and message type

Version number is always 0 for now
Message type is 0 for TCPTunnelRequest

func (*TCPTunnelRequest) UnmarshalBinary

func (req *TCPTunnelRequest) UnmarshalBinary(data []byte) error

Takes byte slice from the wire and unmarshals it. Checks version is 0 and message type is TCPTunnelRequest (0)

type TCPTunnelResponse

type TCPTunnelResponse struct {
	IP net.IP
}

TCP tunneling response packet Server sends ip addres for client after receiving a request to tunnel

func (*TCPTunnelResponse) MarshalBinary

func (resp *TCPTunnelResponse) MarshalBinary() ([]byte, error)

Returns the TCPTunnelResponse as a byte slice. Adds version number and message type

Version number is always 0 for now
Message type is 1 for TCPTunnelResponse

func (*TCPTunnelResponse) UnmarshalBinary

func (resp *TCPTunnelResponse) UnmarshalBinary(data []byte) error

Takes byte slice from the wire and unmarshals it. Checks version is 0 and message type is TCPTunnelResponse (1) Rest of the data in the packet is the IP address

Jump to

Keyboard shortcuts

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