Skip to content

Commit

Permalink
Reverted Go Version to 1.19, Also updated Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
eikarna committed May 11, 2024
1 parent 3821e32 commit c0845eb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enet/
35 changes: 25 additions & 10 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# gotops
# GotoPS
Enet bindings in Go for Growtopia Private Server using cgo. Based on [codecat/go-enet](https://github.com/codecat/go-enet)

## Installation
First, you might need to install enet as a dependency:

* **Windows**: Nothing to do - should work out of the box with the supplied headers and library.
* **Linux**: Install the enet development package with your package manager.
* On Debian-based systems: `apt install libenet-dev`
First, you might need to build enet from enet/ directory and install it as library:

* **Windows**: I don't have PC/Laptop, also no tester. Try it by yourself.
* **Linux**: Install the enet library with make.
```sh
git clone --recurse-submodules https://github.com/eikarna/gotops
cd gotops/enet
autoreconf -vfi
./configure && make && sudo make install
```
* **Termux**: Same as Linux, but after run `autoreconf -vfi`:
```sh
./configure
make
make prefix=/data/data/com.termux/files/usr libdir=/data/data/com.termux/files/usr/lib install
```
If you got warning message: `libtool: warning: remember to run 'libtool --finish /usr/local/lib'`, just run:
```sh
libtool --finish /data/data/com.termux/files/usr/lib
```
* **MacOS**: Install the enet package with brew: `brew install enet`

```
```sh
$ go get github.com/eikarna/gotops
```

Expand All @@ -35,8 +50,8 @@ func main() {
// Initialize enet
enet.Initialize()

// Create a host listening on 0.0.0.0:8095
host, err := enet.NewHost(enet.NewListenAddress(8095), 32, 1, 0, 0)
// Create a host listening on 0.0.0.0:17091
host, err := enet.NewHost(enet.NewListenAddress(17091), 1024, 1, 0, 0)
if err != nil {
log.Error("Couldn't create host: %s", err.Error())
return
Expand Down Expand Up @@ -115,7 +130,7 @@ func main() {
}

// Connect the client host to the server
peer, err := client.Connect(enet.NewAddress("127.0.0.1", 8095), 1, 0)
peer, err := client.Connect(enet.NewAddress("127.0.0.1", 17091), 1, 0)
if err != nil {
log.Error("Couldn't connect: %s", err.Error())
return
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/eikarna/gotops

go 1.22.2
go 1.19

0 comments on commit c0845eb

Please sign in to comment.