Sandertv / gophertunnel

General purpose library for Minecraft Bedrock Edition software written in Go
MIT License
420 stars 96 forks source link

Support for custom transport layers #133

Closed JustTalDevelops closed 2 years ago

JustTalDevelops commented 2 years ago

There is currently a way to listen or dial on a specific network - however, it is fairly limiting with no proper way to register custom transport layers and is non-functional with anything that isn't RakNet.

Sandertv commented 2 years ago

I propose we combine https://pkg.go.dev/image#RegisterFormat and the network parameter in Listen and Dial (https://github.com/Sandertv/gophertunnel/blob/master/minecraft/listener.go#L85). We could have a minecraft.RegisterNetwork function, something like this:

type Network interface {
  ...
}

func RegisterNetwork(name string, n Network) { ... }

to register new networks so that this parameter actually becomes useful.