Coder Social home page Coder Social logo

rcon's Introduction

Rcon

GitHub Build Coverage Go Report Card GoDoc

Source RCON Protocol implementation in Go.

Protocol Specifications

RCON Protocol described in the valve documentation.

Supported Games

Open pull request if you have successfully used a package with another game with rcon support and add it to the list.

Install

go get github.com/gorcon/rcon

See Changelog for release details.

Usage

package main

import (
	"log"
	"fmt"

	"github.com/gorcon/rcon"
)

func main() {
	conn, err := rcon.Dial("127.0.0.1:16260", "password")
	if err != nil {
		log.Fatal(err)
	}
	defer conn.Close()

	response, err := conn.Execute("help")
	if err != nil {
		log.Fatal(err)
	}
	
	fmt.Println(response)	
}

Requirements

Go 1.15 or higher

Contribute

Contributions are more than welcome!

If you think that you have found a bug, create an issue and publish the minimum amount of code triggering the bug so it can be reproduced.

If you want to fix the bug then you can create a pull request. If possible, write a test that will cover this bug.

License

MIT License, see LICENSE

rcon's People

Contributors

json-m avatar outdead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rcon's Issues

SQUAD ListPlayers result limited to 23 playters of 100 (handle multiple packets?)

I faced with issue when I'm executing ListPlayers comand in SQUAD game on full server.
Every execution of ListPlayers returns only 23 players.
So to get full list of players I need run this command 5 (!) times.
Moreover, when I run it 6th time - it returns some random server logs instead of players (2nd screen).
Please fix this strange behaviour.

1 image

Getting connection timed out

I can connect using Rcon.io so I know the server/port is right and accessible.

The specific error (with server and port obfuscated):
rcon: rcon: read packet size: read tcp {server}:{port}->{server}:{port}: i/o timeout

I'll keep looking but figured I'd throw up an issue and see if you were aware of any causes for this.

Why RCON web has to be disabled in Rust?

I am trying to make this work with Rust game and I get i/o timeout. However I saw in the README that RCON web needs to be disabled. I would like to know why and if is possible to keep it enabled and send commands at the same time.
Thanks

`panic: runtime error: makeslice: len out of range` in `rcon.Dial`

My usage: https://github.com/cezarmathe/stevebot/blob/ac309b0f0555ec6f87572caf5f42b92180926789/cmd/stevebot2/main.go#L72

My logs:

1.6525867005549443e+09	info	stevebot2/main.go:55	hello, this is stevebot2
1.6525867005552022e+09	debug	stevebot2/main.go:64	main config	{"value": {"DiscordToken":"redacted","RconAddress":"redacted:25565","RconPassword":"redacted","Bot":{"CommandPrefix":"~"},"Steve":{"AllowedCommands":["help","seed","whitelist"]}}}
panic: runtime error: makeslice: len out of range

goroutine 1 [running]:
github.com/gorcon/rcon.(*Conn).auth(0xc00001e280, {0xc00002604e?, 0xc00002a04d?})
	/path/to/my/go/root/pkg/mod/github.com/gorcon/[email protected]/rcon.go:202 +0x227
github.com/gorcon/rcon.Dial({0xc00002a04d, 0x13}, {0xc00002604e, 0x28}, {0x0, 0x0, 0x1?})
	/path/to/my/go/root/pkg/mod/github.com/gorcon/[email protected]/rcon.go:112 +0x196
main.main()
	/path/to/project/root/stevebot/cmd/stevebot2/main.go:72 +0x668

I've identified that this issue comes from

rcon/rcon.go

Line 202 in 79dc2ba

buffer := make([]byte, response.Size-PacketHeaderSize)

Don't send rcon request with empty command

	result, err = conn.Execute("")
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(result)

got response unknown command It is useless and there is no need to send a request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.