go-raknet is a Go implementation of the RakNet protocol, designed primarily for San Andreas Multiplayer (SA-MP) servers.
It provides reliable UDP communication, packet serialization, and connection management, allowing developers to build custom SA-MP-compatible servers in Go.
⚠️ Note: This library is not perfect and is published as-is because the original maintainer no longer plans to actively develop it. Use at your own discretion.
RakNet is a networking engine widely used in games, offering reliable UDP, packet ordering, and NAT traversal.
go-raknet implements these core features in Go, focusing on SA-MP networking requirements.
This library is suitable for:
- Custom SA-MP server implementations
- Educational purposes for learning multiplayer networking
- Experimenting with RakNet protocol in Go
Important: go-raknet does not include SA-MP server binaries or proprietary code. It only provides networking protocol functionality.
- Reliable and ordered UDP packet delivery
- Connection handshake compatible with RakNet protocol
- Serialization and deserialization of common packet types
- Event-driven API:
OnConnect,OnDisconnect,OnPacket - Supports multiple clients and concurrent connections
- Minimal boilerplate for easy integration into Go projects
go get github.com/ventosilenzioso/go-raknetpackage main
import (
"log"
"github.com/ventosilenzioso/go-raknet"
)
func main() {
server, err := raknet.NewServer(":7777")
if err != nil {
log.Fatal(err)
}
server.OnConnect(func(client *raknet.Client) {
log.Println("Client connected:", client.Address())
})
server.OnDisconnect(func(client *raknet.Client) {
log.Println("Client disconnected:", client.Address())
})
server.OnPacket(func(client *raknet.Client, packet raknet.Packet) {
log.Printf("Received packet %d from %s\n", packet.ID, client.Address())
})
server.Start()
}The event-driven design ensures minimal boilerplate while maintaining full control over connections and packet handling.
Event-driven design is the core principle of go-raknet:
Servermanages client connections and routes packetsClientobjects represent individual connected clientsPacketabstraction simplifies RakNet packet serialization and deserialization
This approach allows handling multiple clients concurrently with simple callbacks.
- go-raknet is not affiliated with SA-MP, Rockstar Games, or RakNet.
- This library is intended for educational purposes and experimental networking projects.
- Distribution of official SA-MP binaries or proprietary content is prohibited.
⚠️ This library is incomplete and may not cover all RakNet features. Use at your own risk.
go-raknet is a Go implementation of the RakNet protocol, designed primarily for San Andreas Multiplayer (SA-MP) servers.
It provides reliable UDP communication, packet serialization, and connection management, allowing developers to build custom SA-MP-compatible servers in Go.
⚠️ Note: This library is not perfect and is published as-is because the original maintainer no longer plans to actively develop it. Use at your own discretion.
RakNet is a networking engine widely used in games, offering reliable UDP, packet ordering, and NAT traversal.
go-raknet implements these core features in Go, focusing on SA-MP networking requirements.
This library is suitable for:
- Custom SA-MP server implementations
- Educational purposes for learning multiplayer networking
- Experimenting with RakNet protocol in Go
Important: go-raknet does not include SA-MP server binaries or proprietary code. It only provides networking protocol functionality.
- Reliable and ordered UDP packet delivery
- Connection handshake compatible with RakNet protocol
- Serialization and deserialization of common packet types
- Event-driven API:
OnConnect,OnDisconnect,OnPacket - Supports multiple clients and concurrent connections
- Minimal boilerplate for easy integration into Go projects
go get github.com/ventosilenzioso/go-raknetpackage main
import (
"log"
"github.com/ventosilenzioso/go-raknet"
)
func main() {
server, err := raknet.NewServer(":7777")
if err != nil {
log.Fatal(err)
}
server.OnConnect(func(client *raknet.Client) {
log.Println("Client connected:", client.Address())
})
server.OnDisconnect(func(client *raknet.Client) {
log.Println("Client disconnected:", client.Address())
})
server.OnPacket(func(client *raknet.Client, packet raknet.Packet) {
log.Printf("Received packet %d from %s\n", packet.ID, client.Address())
})
server.Start()
}The event-driven design ensures minimal boilerplate while maintaining full control over connections and packet handling.
Event-driven design is the core principle of go-raknet:
Servermanages client connections and routes packetsClientobjects represent individual connected clientsPacketabstraction simplifies RakNet packet serialization and deserialization
This approach allows handling multiple clients concurrently with simple callbacks.
- go-raknet is not affiliated with SA-MP, Rockstar Games, or RakNet.
- This library is intended for educational purposes and experimental networking projects.
- Distribution of official SA-MP binaries or proprietary content is prohibited.
⚠️ This library is incomplete and may not cover all RakNet features. Use at your own risk.
- RakNet protocol: Facebook RakNet
- SA-MP protocol research: SA-MP Wiki
- Community examples and documentation
- SA-MP Wiki
- RakNet Protocol Reference
- Examples folder in this repository for usage snippets