connect

package module
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 9

README

Logo

Minekube Connect

GitHub release (latest SemVer) Doc GitHub go.mod Go version Go Report Card test Discord

Connect allows you to connect any Minecraft server, whether it's in online mode, public, behind your protected home network or anywhere else in the world, with our highly available, performant and low latency edge proxies network nearest to you.

Browse active servers now! Join minekube.net with your Minecraft client!

Note that the client is open source, but not the server side production service.

Features

  • ProtoBuf typed
  • Streaming transport protocols
    • WebSocket support
      • equally or more efficient than gRPC
      • better web proxy support: cloudflared, nginx, ...
    • gRPC support (improved developer experience)
      • No immediate support planned, see
  • Minekube Connect plugin support for:
  • Client side service tooling in Go
  • Server side service tooling in Go
  • Client- & service-side tests implementation in Go
  • Awesome documentation website

Documentation

Index

Constants

View Source
const (
	MDPrefix   = "connect-"            // The prefix of Connect metadata keys.
	MDSession  = MDPrefix + "session"  // Metadata key specifying the session id for a Tunnel.
	MDEndpoint = MDPrefix + "endpoint" // Metadata key specifying the watching Endpoint.
)

Well-known headers / metadata keys

Variables

This section is empty.

Functions

func WithTunnelOptions added in v0.4.0

func WithTunnelOptions(ctx context.Context, opts TunnelOptions) context.Context

WithTunnelOptions stores TunnelOptions in a context.

Types

type Addr added in v0.4.0

type Addr string

Addr is an address in the "connect" network.

func (Addr) Network added in v0.4.0

func (a Addr) Network() string

func (Addr) String added in v0.4.0

func (a Addr) String() string

type Authentication added in v0.2.0

type Authentication = pb.Authentication

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type Endpoint

type Endpoint interface {
	Watcher
	Tunneler
}

Endpoint is an endpoint that listens for sessions to either reject them or establish a tunnel for receiving the connection.

type EndpointListener added in v0.4.0

type EndpointListener interface {
	AcceptEndpoint(context.Context, EndpointWatch) error
}

EndpointListener is a network listener for endpoint watches.

type EndpointWatch added in v0.4.0

type EndpointWatch interface {
	// Propose proposes a session to the Endpoint.
	// The Endpoint either rejects the proposal or initiates
	// a Tunnel to receive the session connection.
	Propose(context.Context, *Session) error
	Rejections() <-chan *SessionRejection // Rejections receives rejected session proposals from the Endpoint.
}

EndpointWatch is a watching Endpoint.

type GameProfile

type GameProfile = pb.GameProfile

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type GameProfileProperty

type GameProfileProperty = pb.GameProfileProperty

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type Listener added in v0.4.0

type Listener interface {
	EndpointListener
	TunnelListener
}

Listener listens for watching endpoints and tunnel connections from endpoints.

type Player

type Player = pb.Player

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type ReceiveProposal added in v0.4.0

type ReceiveProposal func(proposal SessionProposal) error

ReceiveProposal is called when Watcher receives a SessionProposal.

type RejectionReason

type RejectionReason = status.Status // The reason why a session proposal is rejected.

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type Session

type Session = pb.Session

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type SessionProposal

type SessionProposal interface {
	Session() *Session                              // The session proposed to connect to the Endpoint.
	Reject(context.Context, *RejectionReason) error // Rejects the session proposal with an optional reason.
}

SessionProposal specifies an incoming session proposal. Use the Session to create the connection tunnel or reject the session with an optional reason.

type SessionRejection

type SessionRejection = pb.SessionRejection

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type Tunnel

type Tunnel net.Conn

Tunnel represents an outbound only tunnel initiated by an Endpoint for a specific SessionProposal.

type TunnelListener added in v0.4.0

type TunnelListener interface {
	AcceptTunnel(context.Context, Tunnel) error
}

TunnelListener is a network listener for tunnel connections.

type TunnelOptions

type TunnelOptions struct {
	// LocalAddr fakes the local address of the Tunnel when specified.
	//
	// If this TunnelOptions destine to Tunneler
	// it is recommended to use the Endpoint address/name.
	//
	// If this TunnelOptions destine to TunnelListener
	// it is recommended to use the underlying network listener address.
	LocalAddr net.Addr
	// RemoteAddr fakes the remote address of the Tunnel when specified.
	//
	// If this TunnelOptions destine to Tunneler
	// it is recommended to use the underlying connection remote address.
	//
	// If this TunnelOptions destine to TunnelListener
	// it is recommended to use the Endpoint address/name.
	RemoteAddr net.Addr // It is recommended to use the player address.
}

TunnelOptions are options for Tunneler and TunnelListener. Use WithTunnelOptions to propagate TunnelOptions in context.

type Tunneler added in v0.4.0

type Tunneler interface {
	Tunnel(context.Context) (Tunnel, error)
}

Tunneler creates a Tunnel.

type WatchRequest

type WatchRequest = pb.WatchRequest

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type WatchResponse

type WatchResponse = pb.WatchResponse

Type alias to better support updating versions. See the referenced type for documentation.

Other go files should only ever use the provided alias type and never import a specific proto version.

type Watcher

type Watcher interface {
	Watch(context.Context, ReceiveProposal) error
}

Watcher registers the calling endpoint and watches for sessions proposed by the WatchService. To stop watching cancel the context. If ReceiveProposal returns a non-nil non-EOF error Watch returns it.

Directories

Path Synopsis
internal
wspb
Package wspb provides helpers for reading and writing protobuf messages.
Package wspb provides helpers for reading and writing protobuf messages.

Jump to

Keyboard shortcuts

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