[Tool/Web/Other] [Golang] Package for working with Query/RCON Mechanism
#1

go-samp-query - Golang package for working with Query Mechanism (SA:MP)
Install


Install the package with:
Code:
go get github.com/urShadow/go-samp-query
Import it with:
Code:
import "github.com/urShadow/go-samp-query"
Examples

Send RCON cmd:

Code:
package main

import (
    "fmt"
    "github.com/urShadow/go-samp-query"
)

func main() {
    server, err := squery.New("127.0.0.1:7777")

    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    response, err := server.SendRCON("rconpassword", "echo Hello, World!")

    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println(response)
}
Get server info:

Code:
package main

import (
    "fmt"
    "github.com/urShadow/go-samp-query"
)

func main() {
    server, _ := squery.New("127.0.0.1:7777")

    info, _ := server.GetInfo()

    fmt.Println(info.Players, info.Maxplayers, info.Hostname)
}
Repository with this: https://github.com/urShadow/go-samp-query

Quote:

No Plagiarism - Do not try to pass something someone else has made as your own.

Warning: I am not the author!!!!
Author: urShadow
Reply


Messages In This Thread
[Golang] Package for working with Query/RCON Mechanism - by povargek - 23.04.2016, 12:22

Forum Jump:


Users browsing this thread: 1 Guest(s)