Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sandertv/go-raknet
Go library implementing a basic version of the RakNet protocol.
https://github.com/sandertv/go-raknet
client go golang net network raknet server
Last synced: 6 days ago
JSON representation
Go library implementing a basic version of the RakNet protocol.
- Host: GitHub
- URL: https://github.com/sandertv/go-raknet
- Owner: Sandertv
- License: mit
- Created: 2019-04-07T10:55:46.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T08:32:06.000Z (3 months ago)
- Last Synced: 2025-01-10T06:26:22.324Z (13 days ago)
- Topics: client, go, golang, net, network, raknet, server
- Language: Go
- Homepage:
- Size: 212 KB
- Stars: 111
- Watchers: 6
- Forks: 40
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-raknet
go-raknet is a library that implements a basic version of the RakNet protocol, which is used for
Minecraft (Bedrock Edition). It implements Unreliable, Reliable and
ReliableOrdered packets and sends user packets as ReliableOrdered.go-raknet attempts to abstract away direct interaction with RakNet, and provides simple to use, idiomatic Go
API used to listen for connections or connect to servers.## Getting started
### Prerequisites
**As of go-raknet version 1.14.0, go-raknet requires at least Go 1.22**. Version 1.12.1 of go-raknet is
the last version of the library that supports Go 1.18 and above.### Usage
go-raknet can be used for both clients and servers, (and proxies, when combined) in a way very similar to the
standard net.TCP* functions.Basic RakNet server:
```go
package mainimport (
"github.com/sandertv/go-raknet"
)func main() {
listener, _ := raknet.Listen("0.0.0.0:19132")
defer listener.Close()
for {
conn, _ := listener.Accept()
b := make([]byte, 1024*1024*4)
_, _ = conn.Read(b)
_, _ = conn.Write([]byte{1, 2, 3})
conn.Close()
}
}
```Basic RakNet client:
```go
package mainimport (
"github.com/sandertv/go-raknet"
)func main() {
conn, _ := raknet.Dial("mco.mineplex.com:19132")
defer conn.Close()
b := make([]byte, 1024*1024*4)
_, _ = conn.Write([]byte{1, 2, 3})
_, _ = conn.Read(b)
}
```### Documentation
[![PkgGoDev](https://pkg.go.dev/badge/github.com/sandertv/go-raknet)](https://pkg.go.dev/github.com/sandertv/go-raknet)## Contact
[![Discord Banner 2](https://discordapp.com/api/guilds/623638955262345216/widget.png?style=banner2)](https://discord.gg/U4kFWHhTNR)