signalserver

package module
v0.0.0-...-8942197 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 12 Imported by: 2

README

PTT.ai Signal Server

pttai-signal-server is a signal server for peers to exchange WebRTC offers/answers.

Install

$ go get github.com/ailabstw/pttai-signal-server

Usage

$ ./pttai-signal-server

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidNodeID = errors.New("invalid node ID")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(nodeID discv5.NodeID, privKey *ecdsa.PrivateKey, url url.URL) (*Client, error)

NewClient init a new client and pass the challenge from the signal-server.

func (*Client) Close

func (c *Client) Close()

func (*Client) Receive

func (c *Client) Receive() (*Signal, error)

Receive receives the normal-msg from signal-server.

func (*Client) Send

func (c *Client) Send(toID discv5.NodeID, msg []byte, extra []byte) error

Send sends the normal-msg to toID.

type Conn

type Conn struct {
	WsConn *websocket.Conn
	// contains filtered or unexported fields
}

func (*Conn) Close

func (conn *Conn) Close()

type NodeConn

type NodeConn struct {
	NodeID discv5.NodeID

	Conn *Conn
	// contains filtered or unexported fields
}

func NewNodeConn

func NewNodeConn(nodeID discv5.NodeID, conn *Conn) *NodeConn

type Server

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

func NewServer

func NewServer() *Server

func (*Server) SignalHandler

func (s *Server) SignalHandler(w http.ResponseWriter, r *http.Request)

SignalHandler will

type Signal

type Signal struct {
	FromID discv5.NodeID `json:"F,omitempty"`
	ToID   discv5.NodeID `json:"T,omitempty"`

	Msg   []byte `json:"M,omitempty"`
	Extra []byte `json:"E,omitempty"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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