meepo_core

package
v0.0.0-20240423 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WATCH_EVENTS_COMMAND_WATCH       = "watch"
	WATCH_EVENTS_COMMAND_UNWATCH     = "unwatch"
	WATCH_EVENTS_COMMAND_UNWATCH_ALL = "unwatchAll"
)
View Source
const (
	EVENT_TRANSPORT_ACTION_NEW   = "mpo.transport.action.new"
	EVENT_TRANSPORT_ACTION_CLOSE = "mpo.transport.action.close"

	EVENT_CHANNEL_ACTION_NEW   = "mpo.channel.action.new"
	EVENT_CHANNEL_ACTION_CLOSE = "mpo.channel.action.close"

	EVENT_TELEPORTATION_ACTION_NEW   = "mpo.teleportation.action.new"
	EVENT_TELEPORTATION_ACTION_CLOSE = "mpo.teleportation.action.close"

	EVENT_TRANSPORT_STATE_NEW          = "mpo.transport.state.new"
	EVENT_TRANSPORT_STATE_CONNECTING   = "mpo.transport.state.connecting"
	EVENT_TRANSPORT_STATE_CONNECTED    = "mpo.transport.state.connected"
	EVENT_TRANSPORT_STATE_DISCONNECTED = "mpo.transport.state.disconnected"
	EVENT_TRANSPORT_STATE_FAILED       = "mpo.transport.state.failed"
	EVENT_TRANSPORT_STATE_CLOSED       = "mpo.transport.state.closed"

	EVENT_CHANNEL_STATE_NEW        = "mpo.channel.state.new"
	EVENT_CHANNEL_STATE_CONNECTING = "mpo.channel.state.connecting"
	EVENT_CHANNEL_STATE_OPEN       = "mpo.channel.state.open"
	EVENT_CHANNEL_STATE_CLOSING    = "mpo.channel.state.closing"
	EVENT_CHANNEL_STATE_CLOSED     = "mpo.channel.state.closed"
)
View Source
const (
	OPTION_DHT_ALPHA                  = "dhtAlpha"
	OPTION_POOF_INTERVAL              = "poofInterval"
	OPTION_POOF_REQUEST_CANDIDATES    = "poofRequestCandidates"
	OPTION_ENABLE_POOF                = "enablePoof"
	OPTION_MEEPO_DEBUG_INTERFACE      = "meepoDebugInterface"
	OPTION_GET_TRACKERS_FUNC          = "getTrackersFunc"
	OPTION_NAVI_REQUEST_QUEUE_TIMEOUT = "naviRequestQueueTimeout"

	METHOD_PING                = "ping"
	METHOD_PERMIT              = "permit"
	METHOD_ADD_PEER_CONNECTION = "addPeerConnection"
)

Variables

View Source
var (
	ErrUnsupportedMethod, ErrUnsupportedMethodFn                          = errors.NewErrorAndErrorFunc[string]("unsupported method")
	ErrTeleportationNotFound, ErrTeleportationNotFoundFn                  = errors.NewErrorAndErrorFunc[string]("teleportation not found")
	ErrTransportNotFound, ErrTransportNotFoundFn                          = errors.NewErrorAndErrorFunc[string]("transport not found")
	ErrTransportFound, ErrTransportFoundFn                                = errors.NewErrorAndErrorFunc[string]("transport found")
	ErrTransportExist, ErrTransportExistFn                                = errors.NewErrorAndErrorFunc[string]("transport exist")
	ErrTrackerNotFound, ErrTrackerNotFoundFn                              = errors.NewErrorAndErrorFunc[string]("tracker not found")
	ErrInvalidNonce, ErrInvalidNonceFn                                    = errors.NewErrorAndErrorFunc[uint32]("invalid nonce")
	ErrRequireProtocolVersionBetween, ErrRequireProtocolVersionBetweenFn_ = errors.NewErrorAndErrorFunc[string]("require protocol version between")
)
View Source
var (
	WithDHTAlpha, GetDHTAlpha                               = option.New[int](OPTION_DHT_ALPHA)
	WithPoofInterval, GetPoofInterval                       = option.New[time.Duration](OPTION_POOF_INTERVAL)
	WithPoofRequestCandidates, GetPoofRequestCandidates     = option.New[int](OPTION_POOF_REQUEST_CANDIDATES)
	WithEnablePoof, GetEnablePoof                           = option.New[bool](OPTION_ENABLE_POOF)
	WithMeepoDebugInterface, GetMeepoDebugInterface         = option.New[string](OPTION_MEEPO_DEBUG_INTERFACE)
	WithGetTrackersFunc, GetGetTrackersFunc                 = option.New[getTrackersFunc](OPTION_GET_TRACKERS_FUNC)
	WithNaviRequestQueueTimeout, GetNaviRequestQueueTimeout = option.New[time.Duration](OPTION_NAVI_REQUEST_QUEUE_TIMEOUT)
)
View Source
var (
	ErrNoAvailableTrackers = fmt.Errorf("no available trackers")
)

Functions

func Addr2ID

func Addr2ID(x addr.Addr) routing_table.ID

func Addrs2IDs

func Addrs2IDs(xs []Addr) (ys []routing_table.ID)

func ContainAddr

func ContainAddr(xs []Addr, t Addr) bool

func ConvertChannelStateToEventName

func ConvertChannelStateToEventName(st meepo_interface.ChannelState) string

func ConvertTransportStateToEventName

func ConvertTransportStateToEventName(st meepo_interface.TransportState) string

func ErrRequireProtocolVersionBetweenFn

func ErrRequireProtocolVersionBetweenFn(from, to string) error

func ID2Addr

func ID2Addr(x routing_table.ID) addr.Addr

func IDs2Addrs

func IDs2Addrs(xs []routing_table.ID) (ys []addr.Addr)

func NewMeepo

func NewMeepo(opts ...NewMeepoOption) (meepo_interface.Meepo, error)

func RequireProtocolVersion

func RequireProtocolVersion[IT, OT any](from string, to string) rpc_core.Middleware[IT, OT]

func ViewChannel

func ViewChannel(c Channel) sdk_interface.ChannelView

func ViewChannelWithAddr

func ViewChannelWithAddr(c Channel, target addr.Addr) sdk_interface.ChannelView

func ViewChannelsWithAddr

func ViewChannelsWithAddr(cs []Channel, target addr.Addr) (cvs []sdk_interface.ChannelView)

func ViewTeleportations

func ViewTeleportations(tps []Teleportation) (tpvs []sdk_interface.TeleportationView)

func ViewTransports

func ViewTransports(ts []Transport) (tvs []sdk_interface.TransportView)

Types

type AddPeerConnectionHandler

type AddPeerConnectionHandler interface {
	OnAddPeerConnection(transport_webrtc.Session, webrtc.SessionDescription) (webrtc.SessionDescription, error)
}

type Addr

type Addr = meepo_interface.Addr

type Channel

type Channel = meepo_interface.Channel

type GetChannelOption

type GetChannelOption = meepo_interface.GetChannelOption

type GetTransportOption

type GetTransportOption = meepo_interface.GetTransportOption

type ListChannelsOption

type ListChannelsOption = meepo_interface.ListChannelsOption

type ListTransportsOption

type ListTransportsOption = meepo_interface.ListTransportsOption

type Meepo

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

func (*Meepo) Addr

func (mp *Meepo) Addr() Addr

func (*Meepo) AsAPIHandler

func (mp *Meepo) AsAPIHandler() rpc_interface.Handler

func (*Meepo) AsTrackerdHandler

func (mp *Meepo) AsTrackerdHandler() rpc_interface.Handler

func (*Meepo) Close

func (mp *Meepo) Close(ctx context.Context) error

func (*Meepo) Diagnostic

func (mp *Meepo) Diagnostic(ctx context.Context) (meepo_interface.DiagnosticReport, error)

func (*Meepo) GetChannel

func (mp *Meepo) GetChannel(ctx context.Context, target Addr, id uint16) (Channel, error)

func (*Meepo) GetLogger

func (mp *Meepo) GetLogger() logging.Logger

func (*Meepo) GetRawLogger

func (mp *Meepo) GetRawLogger() logging.Logger

func (*Meepo) GetTeleportation

func (mp *Meepo) GetTeleportation(ctx context.Context, id string, opts ...GetTeleportationOption) (Teleportation, error)

func (*Meepo) GetTransport

func (mp *Meepo) GetTransport(ctx context.Context, target Addr, opts ...GetTransportOption) (Transport, error)

func (*Meepo) ListChannels

func (mp *Meepo) ListChannels(ctx context.Context, opts ...ListChannelsOption) (cm map[Addr][]Channel, err error)

func (*Meepo) ListChannelsByTarget

func (mp *Meepo) ListChannelsByTarget(ctx context.Context, target Addr, opts ...ListChannelsOption) ([]Channel, error)

func (*Meepo) ListTeleportations

func (mp *Meepo) ListTeleportations(ctx context.Context, opts ...ListTeleportationsOption) (tps []Teleportation, err error)

func (*Meepo) ListTransports

func (mp *Meepo) ListTransports(ctx context.Context, opts ...ListTransportsOption) (ts []Transport, err error)

func (*Meepo) NewChannel

func (mp *Meepo) NewChannel(ctx context.Context, target Addr, network, address string, opts ...NewChannelOption) (Channel, error)

func (*Meepo) NewTeleportation

func (mp *Meepo) NewTeleportation(ctx context.Context, target Addr, sourceNetwork, sourceAddress, sinkNetwork, sinkAddress string, opts ...NewTeleportationOption) (Teleportation, error)

func (*Meepo) NewTransport

func (mp *Meepo) NewTransport(ctx context.Context, target Addr, opts ...NewTransportOption) (Transport, error)

func (*Meepo) Teleport

func (mp *Meepo) Teleport(ctx context.Context, target Addr, sourceNetwork, sourceAddress, sinkNetwork, sinkAddress string, opts ...TeleportOption) (Teleportation, error)

func (*Meepo) WatchEvents

func (mp *Meepo) WatchEvents(ctx context.Context, policies []string, opts ...meepo_interface.WatchEventsOption) (chan meepo_interface.Event, error)
type NaviRequest struct {
	Session   string
	Tracker   Addr
	Candidate Addr
	CreatedAt time.Time
}

type NewChannelOption

type NewChannelOption = meepo_interface.NewChannelOption

type NewMeepoOption

type NewMeepoOption = option.ApplyOption

type NewTransportOption

type NewTransportOption = meepo_interface.NewTransportOption

type PermitRequest

type PermitRequest struct {
	Network string
	Address string
}

type PingRequest

type PingRequest struct {
	Nonce uint32
}

type PingResponse

type PingResponse struct {
	Nonce uint32
}

type TeleportOption

type TeleportOption = meepo_interface.TeleportOption

type Teleportation

type Teleportation = meepo_interface.Teleportation

type Tracker

type Tracker = tracker_interface.Tracker

type Transport

type Transport = meepo_interface.Transport

Jump to

Keyboard shortcuts

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