Categorygithub.com/RustCONxyz/rustcon-go
modulepackage
0.0.0-20240626011551-d39ab8732cb0
Repository: https://github.com/rustconxyz/rustcon-go.git
Documentation: pkg.go.dev

# README

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

# Functions

No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author