Skip to main content

Installation

Gophertunnel is distributed as a Go module and can be easily integrated into your Go projects.

Prerequisites

1

Check Go Version

Gophertunnel requires Go 1.24 or higher. Verify your Go version:
go version
If you need to upgrade, download the latest version from go.dev.
2

Create a New Go Module (Optional)

If you’re starting a new project, create a directory and initialize a Go module:
mkdir my-minecraft-tool
cd my-minecraft-tool
go mod init github.com/yourusername/my-minecraft-tool

Installing Gophertunnel

Install Gophertunnel using go get:
go get github.com/sandertv/gophertunnel
This will download Gophertunnel and all its dependencies, including:
  • github.com/sandertv/go-raknet - RakNet protocol implementation
  • golang.org/x/oauth2 - OAuth2 authentication for Xbox Live
  • github.com/google/uuid - UUID generation
  • And other necessary packages
The go get command will automatically add Gophertunnel to your go.mod file and download all required dependencies.

Verify Installation

Create a simple test file to verify the installation:
package main

import (
    "fmt"
    "github.com/sandertv/gophertunnel/minecraft"
)

func main() {
    fmt.Println("Gophertunnel is installed!")
    fmt.Printf("Minecraft package available: %T\n", minecraft.Dialer{})
}
Run the program:
go run main.go
You should see:
Gophertunnel is installed!
Minecraft package available: minecraft.Dialer

Package Structure

Gophertunnel is organized into several packages:
PackageDescription
minecraftCore package for client/server connections
minecraft/authXbox Live and Microsoft authentication
minecraft/protocolProtocol definitions and packet structures
minecraft/protocol/packetIndividual packet implementations
minecraft/resourceResource pack handling
minecraft/textText formatting and color codes

Import Examples

Here are the most common imports you’ll use:
import (
    "github.com/sandertv/gophertunnel/minecraft"              // Core client/server
    "github.com/sandertv/gophertunnel/minecraft/auth"         // Authentication
    "github.com/sandertv/gophertunnel/minecraft/protocol/packet" // Packet types
)

Updating Gophertunnel

To update to the latest version:
go get -u github.com/sandertv/gophertunnel
go mod tidy
Gophertunnel supports only one Minecraft version at a time (generally the latest official release). When updating, check the release notes for protocol version changes.

Next Steps

Quick Start Guide

Build your first Minecraft client or server with Gophertunnel