meepo

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

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

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_HOP_LIMITED = 16
)
View Source
const (
	MEEPO_ID_MAGIC_CODE = byte(0x22)
)
View Source
const SOCKS5_DOMAIN_SUFFIX = ".mpo"

Variables

View Source
var (
	ACL_ANY        string = "*"
	ACL_ANY_ADDR          = &aclAddr{n: "*", s: "*"}
	ACL_ANY_ENTITY        = NewAclEntity(ACL_ANY, ACL_ANY_ADDR)
)
View Source
var (
	ErrInvalidPeerID            = fmt.Errorf("invalid peer id")
	ErrTransportExist           = fmt.Errorf("transport exists")
	ErrTeleportationNotExist    = fmt.Errorf("teleportation not exists")
	ErrWaitResponseTimeout      = fmt.Errorf("wait response timeout")
	ErrNotWirable               = fmt.Errorf("not wirable")
	ErrUnsupportedSocks5Command = fmt.Errorf("unsupported socks5 command")
	ErrNetworkUnreachable       = fmt.Errorf("network unreachable")
	ErrUnsupportedNetworkType   = fmt.Errorf("unsupported network type")
	ErrNotBroadcastPacket       = fmt.Errorf("not braoadcast packet")
	ErrOutOfEdge                = fmt.Errorf("out of edge")
	ErrTransportNotExist        = fmt.Errorf("transport not exists")
	ErrUnexpectedMessage        = fmt.Errorf("unexpected message")
	ErrUnsupportedMethod        = fmt.Errorf("unsupported method")
	ErrUnexpectedType           = fmt.Errorf("unexpected type")
	ErrNotFound                 = fmt.Errorf("not found")
	ErrUnauthenticated          = fmt.Errorf("unauthenticated")
	ErrUnauthorized             = fmt.Errorf("unauthorized")
	ErrIncorrectSignature       = fmt.Errorf("incorrect signature")
	ErrIncorrectPassword        = fmt.Errorf("incorrect password")
	ErrAclNotAllowed            = fmt.Errorf("acl: not allowed")
	ErrInvalidAclPolicyString   = fmt.Errorf("invalid acl policy string")
)
View Source
var SOCKS5ADDR = new(socks5Addr)

Functions

func AddrContains

func AddrContains(a, b net.Addr) bool

func Ed25519PublicKeyToMeepoID

func Ed25519PublicKeyToMeepoID(pubk ed25519.PublicKey) string

func ErrSendPacket

func ErrSendPacket(err error) errSendPacket

func MeepoIDToEd25519PublicKey

func MeepoIDToEd25519PublicKey(peerID string) (pubk ed25519.PublicKey, err error)

func NewAclAddr

func NewAclAddr(n, s string) net.Addr

func SendMessageError

func SendMessageError(err error) sendMessageError

func SessionChannelClosedError

func SessionChannelClosedError(session int32) error

func SessionChannelExistError

func SessionChannelExistError(session int32) error

func SessionChannelNotExistError

func SessionChannelNotExistError(session int32) error

func SkipPacketSigning

func SkipPacketSigning() ofn.OFN

func UnsupportedMessageDecodeDriverError

func UnsupportedMessageDecodeDriverError(messageIdentifier string) error

func WithAcl

func WithAcl(acl Acl) ofn.OFN

func WithAsSignaling

func WithAsSignaling(b bool) ofn.OFN

func WithAuthorizationName

func WithAuthorizationName(name string) ofn.OFN

func WithAuthorizationSecret

func WithAuthorizationSecret(secret string) ofn.OFN

func WithED25519KeyPair

func WithED25519KeyPair(pubk ed25519.PublicKey, prik ed25519.PrivateKey) ofn.OFN

func WithGatherTimeout

func WithGatherTimeout(d time.Duration) ofn.OFN

func WithGracePeriod

func WithGracePeriod(s string) ofn.OFN

func WithHost

func WithHost(host string) ofn.OFN

func WithICEServers

func WithICEServers(iceServers []string) ofn.OFN

func WithLocalAddress

func WithLocalAddress(local net.Addr) ofn.OFN

func WithLogger

func WithLogger(logger logrus.FieldLogger) ofn.OFN

func WithMeepo

func WithMeepo(mp *Meepo) ofn.OFN

func WithName

func WithName(name string) ofn.OFN

func WithPacket

func WithPacket(p packet.Packet) ofn.OFN

func WithPort

func WithPort(port int32) ofn.OFN

func WithSecret

func WithSecret(secret string) ofn.OFN

func WithSignalingEngine

func WithSignalingEngine(se signaling.Engine) ofn.OFN

func WithSinkFirst

func WithSinkFirst() ofn.OFN

func WithSourceFirst

func WithSourceFirst() ofn.OFN

func WithSubject

func WithSubject(sub string) ofn.OFN

func WithWebrtcAPI

func WithWebrtcAPI(webrtcAPI *webrtc.API) ofn.OFN

Types

type Acl

type Acl interface {
	Allowed(AclChallenge) error
}

func NewAcl

func NewAcl(opts ...NewAclOption) Acl

type AclChallenge

type AclChallenge interface {
	Source() AclEntity
	Destination() AclEntity
	String() string
}

func NewAclChallenge

func NewAclChallenge(source, destination AclEntity) AclChallenge

type AclEntity

type AclEntity interface {
	ID() string
	Addr() net.Addr
	Contains(AclEntity) bool
	String() string
}

func NewAclEntity

func NewAclEntity(id string, addr net.Addr) AclEntity

type AclPolicy

type AclPolicy interface {
	Source() AclEntity
	Destination() AclEntity
	Contains(AclChallenge) bool
	String() string
}

func NewAclPolicy

func NewAclPolicy(source, destination AclEntity) AclPolicy

func ParseAclPolicies

func ParseAclPolicies(ss []string) (ps []AclPolicy, err error)

func ParseAclPolicy

func ParseAclPolicy(s string) (p AclPolicy, err error)

ParseAclPolicy:

Policy: [[[<src-id>:]<src-addr-network>:]<src-addr-host>:<src-addr-port>,][[<dst-id>:]<dst-addr-network>:]<dst-addr-host>:<dst-addr-port>
Rules:
  src-addr-network and dst-addr-network only support tcp or socks5 now.
Examples:
  * => *:*:*:*,*:*:*:*
  192.168.1.1:22 => *:*:*:*,*:*:192.168.1.1:22
  10.0.0.0/24:* => *:*:*:*,*:*:10.0.0.0/24:*
  tcp:10.0.0.1:22 => *:*:*:*,*:tcp:10.0.0.1:22
  a:*:10.0.0.1:22 => *:*:*:*,a:*:10.0.0.1:22
  socks5:*:*,127.0.0.1:80 => *:socks5:*:*,*:*:127.0.0.1:80

type BroadcastRequestHandler

type BroadcastRequestHandler interface {
	Handle(transport.DataChannel, packet.BroadcastPacket)
	HandleBroadcast(transport.DataChannel, packet.BroadcastPacket)
}

type CloseTeleportationRequest

type CloseTeleportationRequest struct {
	Name string
}

type CloseTeleportationResponse

type CloseTeleportationResponse struct{}

type CloseTransportOption

type CloseTransportOption = ofn.OFN

type Copier

type Copier interface {
	Copy() interface{}
}

type DoTeleportRequest

type DoTeleportRequest struct {
	Name  string
	Label string
}

type DoTeleportResponse

type DoTeleportResponse struct{}

type GetTeleportationFunc

type GetTeleportationFunc func(string) (teleportation.Teleportation, bool)

type GetTeleportationOption

type GetTeleportationOption = ofn.OFN

type Meepo

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

func NewMeepo

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

func (*Meepo) Authenticate

func (mp *Meepo) Authenticate(subject string, opts ...auth.AuthenticateOption) (err error)

func (*Meepo) Authorize

func (mp *Meepo) Authorize(subject, object, action string, opts ...auth.AuthorizeOption) error

func (*Meepo) CloseTeleportation

func (mp *Meepo) CloseTeleportation(name string) error

func (*Meepo) CloseTransport

func (mp *Meepo) CloseTransport(peerID string) error

func (*Meepo) GetAuthorizationName

func (mp *Meepo) GetAuthorizationName() string

func (*Meepo) GetID

func (mp *Meepo) GetID() string

func (*Meepo) GetTeleportation

func (mp *Meepo) GetTeleportation(name string, opts ...GetTeleportationOption) (teleportation.Teleportation, error)

func (*Meepo) ListTeleportations

func (mp *Meepo) ListTeleportations() ([]teleportation.Teleportation, error)

func (*Meepo) ListTransports

func (mp *Meepo) ListTransports() ([]transport.Transport, error)

func (*Meepo) NewTeleportation

func (mp *Meepo) NewTeleportation(id string, remote net.Addr, opts ...NewTeleportationOption) (teleportation.Teleportation, error)

func (*Meepo) NewTransport

func (mp *Meepo) NewTransport(peerID string) (transport.Transport, error)

func (*Meepo) Ping

func (mp *Meepo) Ping(id string, payload string) error

func (*Meepo) SetWireHandler

func (mp *Meepo) SetWireHandler(h signaling.WireHandler)

func (*Meepo) Teleport

func (mp *Meepo) Teleport(peerID string, remote net.Addr, opts ...TeleportOption) (net.Addr, error)

func (*Meepo) Version

func (mp *Meepo) Version() *version.V

func (*Meepo) Wire

func (mp *Meepo) Wire(peerID string, src *signaling.Descriptor) (*signaling.Descriptor, error)

type MeepoBroadcastRequestHandler

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

func (*MeepoBroadcastRequestHandler) Handle

func (*MeepoBroadcastRequestHandler) HandleBroadcast

type MeepoRequestHandler

type MeepoRequestHandler func(transport.DataChannel, packet.Packet)

func (MeepoRequestHandler) Handle

type Method

type Method string
const (
	METHOD_NEW_TELEPORTATION Method = "newTeleportation"
	METHOD_DO_TELEORT        Method = "doTeleport"
)
const (
	METHOD_CLOSE_TELEPORTATION Method = "closeTeleportation"
)
const (
	METHOD_CLOSE_TRANSPORT Method = "closeTransport"
)
const (
	METHOD_PING Method = "ping"
)
const (
	METHOD_WIRE Method = "wire"
)

type NewAclOption

type NewAclOption = ofn.OFN

func WithAllowPolicies

func WithAllowPolicies(ps []AclPolicy) NewAclOption

func WithBlockPolicies

func WithBlockPolicies(ps []AclPolicy) NewAclOption

type NewMeepoOption

type NewMeepoOption = ofn.OFN

type NewSocks5ServerOption

type NewSocks5ServerOption = ofn.OFN

type NewTeleportationOption

type NewTeleportationOption = ofn.OFN

type NewTeleportationRequest

type NewTeleportationRequest struct {
	Name          string
	LocalNetwork  string
	LocalAddress  string
	RemoteNetwork string
	RemoteAddress string
	HashedSecret  string
}

type NewTeleportationResponse

type NewTeleportationResponse struct{}

type PingRequest

type PingRequest struct {
	Payload string
}

type PongResponse

type PongResponse struct {
	Payload string
}

type RequestHandler

type RequestHandler interface {
	Handle(transport.DataChannel, packet.Packet)
}

type SignalingEngineWrapper

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

func (*SignalingEngineWrapper) Close

func (e *SignalingEngineWrapper) Close() error

func (*SignalingEngineWrapper) OnWire

func (*SignalingEngineWrapper) Wire

type Socks5Server

type Socks5Server interface {
	Start(context.Context) error
	Stop(context.Context) error
	Wait() error
}

func NewSocks5Server

func NewSocks5Server(opts ...NewSocks5ServerOption) (Socks5Server, error)

type TeleportOption

type TeleportOption = ofn.OFN

type WireRequest

type WireRequest struct {
	Descriptor *signaling.Descriptor
}

type WireResponse

type WireResponse struct {
	Descriptor *signaling.Descriptor
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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