Skip to main content
Gophertunnel provides several complete examples to help you get started with building Minecraft Bedrock Edition network tools. These examples demonstrate the core functionality of the library.

Available Examples

Client Example

Connect to a Minecraft server and interact with packets

Server Example

Create a custom Minecraft server that accepts connections

Proxy Example

Build a proxy that forwards players between servers

Getting Started

All examples use the main github.com/sandertv/gophertunnel/minecraft package. Make sure you have it installed:
go get github.com/sandertv/gophertunnel/minecraft
These examples are extracted from the actual Gophertunnel source code and represent real, working implementations.

Common Patterns

Across all examples, you’ll notice some common patterns:
  • Packet Handling: All connections use ReadPacket() and WritePacket() for communication
  • Error Handling: Network operations return errors that should be handled appropriately
  • Authentication: Clients use auth.TokenSource for Microsoft authentication
  • Concurrency: Servers and proxies use goroutines to handle multiple connections
Start with the client example to understand basic packet handling, then move on to the server and proxy examples for more advanced use cases.