aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/bearbin
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2018-10-19 06:24:23 -0700
committerChristine Dodrill <me@christine.website>2018-10-19 06:28:37 -0700
commit273b48a8b409126e14f8beb23cee4255d1f08a2c (patch)
treefeb316d464d92e143732ca3eac525fe4ca3cda1d /vendor/github.com/bearbin
parent456deb2bbadbcc8fd218a2297ac4879c069ef0ba (diff)
downloadx-273b48a8b409126e14f8beb23cee4255d1f08a2c.tar.xz
x-273b48a8b409126e14f8beb23cee4255d1f08a2c.zip
GOPROXY means we can avoid vendoring
Diffstat (limited to 'vendor/github.com/bearbin')
-rw-r--r--vendor/github.com/bearbin/mcgorcon/.gitignore23
-rw-r--r--vendor/github.com/bearbin/mcgorcon/.travis.yml6
-rw-r--r--vendor/github.com/bearbin/mcgorcon/LICENSE21
-rw-r--r--vendor/github.com/bearbin/mcgorcon/README.md4
-rw-r--r--vendor/github.com/bearbin/mcgorcon/mcgorcon.go141
5 files changed, 0 insertions, 195 deletions
diff --git a/vendor/github.com/bearbin/mcgorcon/.gitignore b/vendor/github.com/bearbin/mcgorcon/.gitignore
deleted file mode 100644
index 8365624..0000000
--- a/vendor/github.com/bearbin/mcgorcon/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
diff --git a/vendor/github.com/bearbin/mcgorcon/.travis.yml b/vendor/github.com/bearbin/mcgorcon/.travis.yml
deleted file mode 100644
index 3b4e5c0..0000000
--- a/vendor/github.com/bearbin/mcgorcon/.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-language: go
-go:
- - 1.1
- - 1.2
- - release
- - tip \ No newline at end of file
diff --git a/vendor/github.com/bearbin/mcgorcon/LICENSE b/vendor/github.com/bearbin/mcgorcon/LICENSE
deleted file mode 100644
index aa7af03..0000000
--- a/vendor/github.com/bearbin/mcgorcon/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Alexander Harkness
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE. \ No newline at end of file
diff --git a/vendor/github.com/bearbin/mcgorcon/README.md b/vendor/github.com/bearbin/mcgorcon/README.md
deleted file mode 100644
index 16ad172..0000000
--- a/vendor/github.com/bearbin/mcgorcon/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-mcgorcon [![Build Status](https://travis-ci.org/bearbin/mcgorcon.svg?branch=master)](https://travis-ci.org/bearbin/mcgorcon) [![GoDoc](https://godoc.org/github.com/bearbin/mcgorcon?status.png)](https://godoc.org/github.com/bearbin/mcgorcon)
-=========
-
-A Minecraft RCON Client in Go
diff --git a/vendor/github.com/bearbin/mcgorcon/mcgorcon.go b/vendor/github.com/bearbin/mcgorcon/mcgorcon.go
deleted file mode 100644
index ead96cb..0000000
--- a/vendor/github.com/bearbin/mcgorcon/mcgorcon.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Package mcgorcon is a Minecraft RCON Client written in Go.
-// It is designed to be easy to use and integrate into your own applications.
-package mcgorcon
-
-import (
- "bytes"
- "encoding/binary"
- "fmt"
- "errors"
- "io"
- "net"
- "time"
-)
-
-type packetType int32
-
-// Client is a representation of an RCON client.
-type Client struct {
- password string
- connection net.Conn
-}
-
-// header is the header of a Minecraft RCON packet.
-type header struct {
- Size int32
- RequestID int32
- PacketType packetType
-}
-
-const packetTypeCommand packetType = 2
-const packetTypeAuth packetType = 3
-const requestIDBadLogin int32 = -1
-
-// Dial up the server and establish a RCON conneciton.
-func Dial(host string, port int, pass string) (Client, error) {
- // Combine the host and port to form the address.
- address := host + ":" + fmt.Sprint(port)
- // Actually establish the conneciton.
- conn, err := net.DialTimeout("tcp", address, 10*time.Second)
- if err != nil {
- return Client{}, err
- }
- // Create the client object, since the connection has been established.
- c := Client{password: pass, connection: conn}
- // TODO - server validation to make sure we're talking to a real RCON server.
- // For now, just return the client and assume it's a real server.
- return c, nil
-}
-
-// SendCommand sends a command to the server and returns the result (often nothing).
-func (c *Client) SendCommand(command string) (string, error) {
- // Because I'm lazy, just authenticate with every command.
- err := c.authenticate()
- if err != nil {
- return "", err
- }
-
- // Send the packet.
- head, payload, err := c.sendPacket(packetTypeCommand, []byte(command))
- if err != nil {
- return "", err
- }
-
- // Auth was bad, throw error.
- if head.RequestID == requestIDBadLogin {
- return "", errors.New("Bad auth, could not send command.")
- }
- return string(payload), nil
-}
-
-// authenticate authenticates the user with the server.
-func (c *Client) authenticate() error {
- // Send the packet.
- head, _, err := c.sendPacket(packetTypeAuth, []byte(c.password))
- if err != nil {
- return err
- }
-
- // If the credentials were bad, throw error.
- if head.RequestID == requestIDBadLogin {
- return errors.New("Bad auth, could not authenticate.")
- }
-
- return nil
-}
-
-// sendPacket sends the binary packet representation to the server and returns the response.
-func (c *Client) sendPacket(t packetType, p []byte) (header, []byte, error) {
- // Generate the binary packet.
- packet, err := packetise(t, p)
- if err != nil {
- return header{}, nil, err
- }
-
- // Send the packet over the wire.
- _, err = c.connection.Write(packet)
- if err != nil {
- return header{}, nil, err
- }
- // Receive and decode the response.
- head, payload, err := depacketise(c.connection)
- if err != nil {
- return header{}, nil, err
- }
-
- return head, payload, nil
-}
-
-// packetise encodes the packet type and payload into a binary representation to send over the wire.
-func packetise(t packetType, p []byte) ([]byte, error) {
- // Generate a random request ID.
- pad := [2]byte{}
- length := int32(len(p) + 10)
- var buf bytes.Buffer
- binary.Write(&buf, binary.LittleEndian, length)
- binary.Write(&buf, binary.LittleEndian, int32(0))
- binary.Write(&buf, binary.LittleEndian, t)
- binary.Write(&buf, binary.LittleEndian, p)
- binary.Write(&buf, binary.LittleEndian, pad)
- // Notchian server doesn't like big packets :(
- if buf.Len() >= 1460 {
- return nil, errors.New("Packet too big when packetising.")
- }
- // Return the bytes.
- return buf.Bytes(), nil
-}
-
-// depacketise decodes the binary packet into a native Go struct.
-func depacketise(r io.Reader) (header, []byte, error) {
- head := header{}
- err := binary.Read(r, binary.LittleEndian, &head)
- if err != nil {
- return header{}, nil, err
- }
- payload := make([]byte, head.Size-8)
- _, err = io.ReadFull(r, payload)
- if err != nil {
- return header{}, nil, err
- }
- return head, payload[:len(payload)-2], nil
-}