diff options
| -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) +} |
