common

package
v0.0.0-...-2fc0e29 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QUICCfg = quic.Config{
	MaxIncomingStreams:    int64(2 << 16),
	MaxIncomingUniStreams: int64(2 << 16),
	MaxIdleTimeout:        16 * time.Second,
	KeepAlivePeriod:       8 * time.Second,
}
View Source
var Version = "v0.0.2"

Must be a valid semver

View Source
var VersionHeader = "X-BF-Version"

Functions

func Debug

func Debug(msg interface{})

Log a debug level message

func Debugf

func Debugf(format string, args ...interface{})

Log a debug level message

func DecodeSignalMsg

func DecodeSignalMsg(raw []byte) (string, interface{}, error)

func IsPublicAddr

func IsPublicAddr(addr net.IP) bool

func SetDebugLogger

func SetDebugLogger(l *log.Logger)

Override the Logger used by broflake for debug messages

Types

type ConsumerInfo

type ConsumerInfo struct {
	Addr net.IP
	Tag  string
}

TODO: ConsumerInfo is the downstream router's counterpart to PathAssertion. It's meant to describe useful information about a downstream connectivity situation. Like PathAssertion, a Nil() ConsumerInfo indicates no connectivity. ConsumerInfo lives here both to keep things consistent and because we imagine that ConsumerInfo objects may be served by Freddie, who will also perform the required IP geolocation during the discovery and matchmaking process. ConsumerInfo might one day evolve to become the consumer-side constraints object which is discussed in the RFCs, at which point it might make sense to collapse PathAssertion and ConsumerInfo into a single concept. ConsumerInfo (and its client-specific accomplice, ConsumerInfoIPC) were motivated solely to provide UI status information, and it's irksome that they exist for this reason alone.

func (ConsumerInfo) Nil

func (ci ConsumerInfo) Nil() bool

type DebugAddr

type DebugAddr string

func (DebugAddr) Network

func (a DebugAddr) Network() string

func (DebugAddr) String

func (a DebugAddr) String() string

type Endpoint

type Endpoint struct {
	Host     string
	Distance uint
}

type GenesisMsg

type GenesisMsg struct {
	PathAssertion PathAssertion
}

type ICECandidate

type ICECandidate struct {
	Foundation     string             `json:"foundation"`
	Priority       uint32             `json:"priority"`
	Address        string             `json:"address"`
	Protocol       webrtc.ICEProtocol `json:"protocol"`
	Port           uint16             `json:"port"`
	Typ            int                `json:"type"`
	Component      uint16             `json:"component"`
	RelatedAddress string             `json:"relatedAddress"`
	RelatedPort    uint16             `json:"relatedPort"`
	TCPType        string             `json:"tcpType"`
	// contains filtered or unexported fields
}

type OfferMsg

type OfferMsg struct {
	SDP webrtc.SessionDescription
	Tag string
}

TODO: We observe that OfferMsg and ConsumerInfo have a special relationship: OfferMsg is how consumer data goes in, and ConsumerInfo is how consumer data comes out. A consumer's 'Tag' is supplied at offer time, encapsulated in an OfferMsg; later, that Tag is surfaced to the producer's UI layer in a ConsumerInfo struct. This suggests that these structures can probably be collapsed into a single concept.

type PathAssertion

type PathAssertion struct {
	Allow []Endpoint
	Deny  []Endpoint
}

func (PathAssertion) Nil

func (pa PathAssertion) Nil() bool

type QUICStreamNetConn

type QUICStreamNetConn struct {
	quic.Stream
	OnClose    func()
	AddrLocal  net.Addr
	AddrRemote net.Addr
}

XXX: AddrLocal and AddrRemote were added for compatibility with http-proxy-lantern, and they must be a type from the Golang standard library (TCPAddr, UDPAddr, etc.) rather than a user-defined type. There's no reason to keep this state other than that http-proxy-lantern is interested in it, and it complains if it doesn't receive a "regular" net.Addr type.

func (QUICStreamNetConn) Close

func (c QUICStreamNetConn) Close() error

func (QUICStreamNetConn) LocalAddr

func (c QUICStreamNetConn) LocalAddr() net.Addr

func (QUICStreamNetConn) RemoteAddr

func (c QUICStreamNetConn) RemoteAddr() net.Addr

type SignalMsg

type SignalMsg struct {
	ReplyTo string
	Type    SignalMsgType
	Payload string
}

A little confusing: SignalMsg is actually the parent msg which encapsulates an underlying msg, which could be a GenesisMsg, an OfferMsg, a webrtc.SessionDescription (which is currently sent unencapsulated as a SignalMsgAnswer), or a slice of webrtc.ICECandidate (which is currently sent unencapsulated as a SignalMsgICE)

type SignalMsgType

type SignalMsgType int
const (
	SignalMsgGenesis SignalMsgType = iota
	SignalMsgOffer
	SignalMsgAnswer
	SignalMsgICE
)

func (SignalMsgType) String

func (t SignalMsgType) String() string

Jump to

Keyboard shortcuts

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