node

package module
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: 17 Imported by: 1

README

This library is responsible for handling all of the routing. See godoc.org/github.com/AutoRoute/node for the full documentation

And see https://docs.google.com/document/d/1NBk83bfj6MLgDD6USidSethKqV6-cNa-ZO4odNrdcCc/edit?usp=sharing for a high level description of the project.

See https://docs.google.com/presentation/d/1b_Gl22d4e5oD5Z_4RMf-gjaCdrmqAzev6fSIaG7-uHw/edit?usp=sharing for a presentation about the project.

If you'd like to just spin up a node and start playing around with it, you can either run build and run them locally, or just use docker.

sudo docker run -p 30000:34321 --name p1  c00w/autoroute:latest -fakemoney
sudo docker run -p 30001:34321 --name p2 --link=p1:p1 c00w/autoroute:latest -fakemoney -connect p1:34321

If you're trying to play with it for testing, I'd reccomend setting up testnet in a box and using

autoroute -btc_user=admin1 -btc_pass=123 -btc_host=localhost:19001

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKey

func CreateKey(keyfile string) (*os.File, internal.PrivateKey, error)

Creates a new keyfile Args:

keyfile: name of the keyfile

Returns:

file, pirvate key, error

func FakeMoney

func FakeMoney() types.Money

Represents a money type which is fake and purely usable for testing

func NewRPCMoney

func NewRPCMoney(host, user, pass string) (types.Money, error)

Represents a money connection to an active bitcoin server

func SetDevAddr

func SetDevAddr(dev string, addr string) error

SetDevAddr takes a network interface name and an IP address in string form and sets the device up and assigns it an IP address.

Types

type DataConnection

type DataConnection interface {
	SendPacket(types.Packet) error
	Packets() <-chan types.Packet
}

Represents an object capable of sending and receiving packets.

type Key

type Key struct {
	// contains filtered or unexported fields
}

func LoadKey

func LoadKey(keyfile string) (Key, error)

Loads a key from a keyfile Args:

keyfile: name of the keyfile

Returns:

private key (type Key)

func NewKey

func NewKey() (Key, error)

func (Key) String

func (k Key) String() string

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is used for logging information about what the node knows about the network, where packets are being sent, and confirmation that the packets are were sent (their receipts). Ideally this is all the information required for an intelligent routing algorithm.

func NewLogger

func NewLogger(w io.Writer) Logger

func (Logger) LogBloomFilter

func (lgr Logger) LogBloomFilter(brm *internal.BloomReachabilityMap) error

LogBloomFilter logs the node's conglomerate bloom filter. Should be called every time a new bloom filter is received.

func (Logger) LogPacketReceipt

func (lgr Logger) LogPacketReceipt(packet_hash types.PacketHash) error

LogPacketReceipt logs a packet hash from a received receipt. Should be called every time a receipt is received.

func (Logger) LogRoutingDecision

func (lgr Logger) LogRoutingDecision(dest types.NodeAddress, next types.NodeAddress, packet_size int, amt int64, packet_hash types.PacketHash) error

LogRoutingDecision logs information on a sent packet. Should be called every time a packet is sent.

type Node

type Node struct {
	// contains filtered or unexported fields
}

A Node is the highest level abstraction over the network. You receive packets from it and send packets to it, and it takes care of everything else.

func (Node) GetNodeAddress

func (n Node) GetNodeAddress() types.NodeAddress

func (Node) IsReachable

func (n Node) IsReachable(addr types.NodeAddress) bool

func (Node) Packets

func (n Node) Packets() <-chan types.Packet

func (Node) SendPacket

func (n Node) SendPacket(p types.Packet) error

type NodeConnection

type NodeConnection interface {
	DataConnection
	GetNodeAddress() types.NodeAddress
}

NodeConnection is an AutoRoute connection between two AutoRoute nodes. It implements a DataConnection (can send and receive AutoRoute packets) but also has a NodeAddress.

type Server

type Server struct {
	// contains filtered or unexported fields
}

The server handles creating connections and listening on various ports.

func NewServer

func NewServer(key Key, m types.Money, logger *log.Logger, route_logger Logger) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Connect

func (s *Server) Connect(addr string) error

func (*Server) Listen

func (s *Server) Listen(addr string) error

func (*Server) Node

func (s *Server) Node() Node

func (*Server) Probe

func (s *Server) Probe(dev net.Interface) error

type TCPTun

type TCPTun interface {
	ReadPacket() (*tuntap.Packet, error)
	WritePacket(p *tuntap.Packet) error
}

type TCPTunClient

type TCPTunClient struct {
	// contains filtered or unexported fields
}

func NewTCPTunClient

func NewTCPTunClient(n NodeConnection, tun TCPTun, dest types.NodeAddress, amt int64, tun_name string) *TCPTunClient

NewTCPTunnel creates and starts a TCP tunneling client. After creating a TCP object, it starts the handshake to the server (exit node) specified by dest and returns a pointer to the TCP object. Then it starts listening on the tun and node connection.

func (*TCPTunClient) Close

func (t *TCPTunClient) Close()

func (*TCPTunClient) Error

func (t *TCPTunClient) Error() chan error

type TCPTunServer

type TCPTunServer struct {
	// contains filtered or unexported fields
}

func NewTCPTunServer

func NewTCPTunServer(n NodeConnection, tun TCPTun, amt int64) *TCPTunServer

NewTCPTunServer just constructs and returns a TCPTunServer with the given paramters. Unlike NewTCPTunClient, it does not start listening.

func (*TCPTunServer) Close

func (ts *TCPTunServer) Close()

func (*TCPTunServer) Error

func (ts *TCPTunServer) Error() chan error

func (*TCPTunServer) Listen

func (ts *TCPTunServer) Listen()

Listen() starts listening on the tun and AutoRoute connection

type UnixSocket

type UnixSocket struct {
	// contains filtered or unexported fields
}

func NewUnixSocket

func NewUnixSocket(path string, d DataConnection) (*UnixSocket, error)

Creates a unix socket which all packets are sent to /from.

func (*UnixSocket) Close

func (u *UnixSocket) Close()

Directories

Path Synopsis
This binary is the canonical way to use autoroute.
This binary is the canonical way to use autoroute.

Jump to

Keyboard shortcuts

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