Skip to content

RustCON Go is a Go library for interacting with Rust servers via WebSockets (Web RCON)

License

Notifications You must be signed in to change notification settings

RustCONxyz/rustcon-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RustCON Go

RustCON Go is a Go library for interacting with Rust servers via WebSockets (Web RCON)

Links

Installation

go get github.com/RustCONxyz/rustcon-go

Example Usage

package main

import (
    "fmt"
    "log"
    "time"

    "github.com/RustCONxyz/rustcon-go"
)

func main() {
    connection := &rustcon.RconConnection{
        IP:       "127.0.0.1",
        Port:     28016,
        Password: "password",
        OnConnected: func() {
            fmt.Println("Connected to RCON")
        },
        OnMessage: func(message *rustcon.Message) {
            fmt.Println(message.Message)
        },
        OnChatMessage: func(chatMessage *rustcon.ChatMessage) {
            fmt.Println(chatMessage.Message)
        },
        OnDisconnected: func() {
            fmt.Println("Disconnected from RCON")
        },
    }

    if err := connection.Connect(); err != nil {
        log.Fatal(err)
    }

    serverInfo, err := connection.SendCommand("serverinfo")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(serverInfo.Message)
}

License

MIT

About

RustCON Go is a Go library for interacting with Rust servers via WebSockets (Web RCON)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Languages