signalserver

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

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

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 NodeID, privKey *ed25519.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 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 NodeID

	Conn *Conn
	// contains filtered or unexported fields
}

func NewNodeConn

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

type NodeID

type NodeID ed25519.PublicKey

func (NodeID) Equal

func (id NodeID) Equal(x NodeID) bool

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 NodeID
	ToID   NodeID

	Msg   []byte
	Extra []byte
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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