diff options
| author | Christine Dodrill <xena@yolo-swag.com> | 2015-06-23 12:30:17 -0700 |
|---|---|---|
| committer | Christine Dodrill <xena@yolo-swag.com> | 2015-06-23 12:30:17 -0700 |
| commit | 2ab3d79feeb67b50f4b685c5e0286e2d36ccddc8 (patch) | |
| tree | 935c33eba74215fa14ac909474392271ad7eade4 | |
| parent | 4b9a6cd3d59be6086ee7b00d888be4bbb46e3d79 (diff) | |
| download | x-2ab3d79feeb67b50f4b685c5e0286e2d36ccddc8.tar.xz x-2ab3d79feeb67b50f4b685c5e0286e2d36ccddc8.zip | |
Add minecraft rcon client
| -rw-r--r-- | mcrcon/.gitignore | 1 | ||||
| -rw-r--r-- | mcrcon/main.go | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/mcrcon/.gitignore b/mcrcon/.gitignore new file mode 100644 index 0000000..9247261 --- /dev/null +++ b/mcrcon/.gitignore @@ -0,0 +1 @@ +mcrcon diff --git a/mcrcon/main.go b/mcrcon/main.go new file mode 100644 index 0000000..1c5ebd6 --- /dev/null +++ b/mcrcon/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "flag" + "fmt" + "log" + "strings" + + "github.com/bearbin/mcgorcon" +) + +var ( + host = flag.String("host", "127.0.0.1", "server hostname") + port = flag.Int("port", 25575, "rcon port") + password = flag.String("pass", "swag", "rcon password") +) + +func main() { + flag.Parse() + + client, err := mcgorcon.Dial(*host, *port, *password) + if err != nil { + log.Fatal(err) + } + + data, err := client.SendCommand(strings.Join(flag.Args(), " ")) + if err != nil { + log.Fatal(err) + } + + fmt.Println(data) +} |
