p2p

package
v0.0.0-...-27aaa03 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: AGPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPServer

func HTTPServer(port int, handler HTTPRespHandler) error

func ServeConn

func ServeConn(src net.Conn, dst io.ReadWriteCloser)

Types

type Answer

type Answer struct {
	Inner SDPAndIce `json:"answer"`
}

type BackResponse

type BackResponse struct {
	Pub         string `json:"nodePub"`
	ETHBlock    uint32 `json:"ethBlock"`
	PoWSolution uint64 `json:"powSolution"` // TODO: Equihash
	Answer      string `json:"answerSDP"`
}

see orchid-core/src/index.ts interface BackResponse

type DCReadWriteCloser

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

DCReadWriteCloser wraps webrtc.DataChannel with a mutex for

concurrent access and a byte buffer and closed flag to implement
the io.ReadWriterCloser interface as a more generic way of interfacing
with the TCPProxy or other Reader / Writer interfaces

func NewDCReadWriteCloser

func NewDCReadWriteCloser(dc *webrtc.DataChannel, dbg string) *DCReadWriteCloser

func (*DCReadWriteCloser) Close

func (d *DCReadWriteCloser) Close() (err error)

func (*DCReadWriteCloser) Read

func (d *DCReadWriteCloser) Read(p []byte) (n int, err error)

func (*DCReadWriteCloser) Write

func (d *DCReadWriteCloser) Write(p []byte) (n int, err error)

type HTTPRespHandler

type HTTPRespHandler func([]byte) ([]byte, error)

type Offer

type Offer struct {
	Inner SDPAndIce `json:"offer"`
}

type SDPAndIce

type SDPAndIce struct {
	Description webrtc.SessionDescription `json:"description"`
	Candidates  []*webrtc.IceCandidate
}

TODO: this JSON schema is temp in lieu of first protocol spec lockdown

type SOCKSProxy

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

func NewSOCKSProxy

func NewSOCKSProxy() (*SOCKSProxy, error)

func (*SOCKSProxy) ListenAndServe

func (s *SOCKSProxy) ListenAndServe(port int) error

type TCPProxy

type TCPProxy struct {
	Host   string
	DstGen func() (io.ReadWriteCloser, error)
}

func NewTCPProxy

func NewTCPProxy(port int, dstGen func() (io.ReadWriteCloser, error)) (*TCPProxy, error)

func (*TCPProxy) ListenAndServe

func (ts *TCPProxy) ListenAndServe() error

type WebRTCPeer

type WebRTCPeer struct {
	Mutex    sync.Mutex
	RefURL   *url.URL
	PC       *webrtc.PeerConnection
	DCs      []*webrtc.DataChannel
	DCLabel  uint64
	IceCands []*webrtc.IceCandidate
}

func NewExit

func NewExit(b []byte, dcReady chan *DCReadWriteCloser) ([]byte, *WebRTCPeer, error)

func NewWebRTCPeer

func NewWebRTCPeer(ref *url.URL) (*WebRTCPeer, error)

func (*WebRTCPeer) NewDataChannel

func (p *WebRTCPeer) NewDataChannel() (*webrtc.DataChannel, error)

Jump to

Keyboard shortcuts

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