relay

package
v0.0.0-...-0ce3ae6 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialRelayed

func DialRelayed(network, myID, peerId, relayAddress string) (net.Conn, error)

func StartServerMode

func StartServerMode(myKey string, port int)

Types

type Client

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

type ClientManager

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

type RelayConn

type RelayConn struct {
	MyID   string
	PeerID string //pearId
	Relay  net.Conn
	Data   chan *[]byte
}

func (RelayConn) Close

func (this RelayConn) Close() error

func (RelayConn) LocalAddr

func (this RelayConn) LocalAddr() net.Addr

func (RelayConn) Read

func (this RelayConn) Read(b []byte) (n int, err error)

func (RelayConn) RemoteAddr

func (this RelayConn) RemoteAddr() net.Addr

func (RelayConn) SetDeadline

func (this RelayConn) SetDeadline(t time.Time) error

func (RelayConn) SetReadDeadline

func (this RelayConn) SetReadDeadline(t time.Time) error

func (RelayConn) SetWriteDeadline

func (this RelayConn) SetWriteDeadline(t time.Time) error

func (RelayConn) Write

func (this RelayConn) Write(b []byte) (n int, err error)

type RelayManager

type RelayManager struct {
	MyId              string
	RelayConnections  map[string]*net.Conn //the key can be the address or maybe we should get an Id from the relay.
	ClientConnections map[string]*RelayConn
}

Singleton object to keep a list of all connected relays. each relay can have a connection to more than one peer so the tcp connection will be reused.

type RelayMessage

type RelayMessage struct {
	Type    string
	FromKey string
	ToKey   string
	Message []byte
}

Jump to

Keyboard shortcuts

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