Compare commits

...

2 commits

Author SHA1 Message Date
cde545b144 Move test password to a global constant 2021-04-06 18:06:59 +02:00
3f1ed29b91 Fix typos 2021-04-06 18:03:06 +02:00
2 changed files with 10 additions and 8 deletions

View file

@ -5,7 +5,7 @@ This is a fork from [james4k/rcon](https://github.com/james4k/rcon) with the sup
## Usage ## Usage
```golang ```golang
// Espablish a connection. // Establish a connection.
remoteConsole, err := rcon.Dial("127.0.0.1", "password") remoteConsole, err := rcon.Dial("127.0.0.1", "password")
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@ -30,10 +30,10 @@ fmt.Println(response)
``` ```
## License ## License
This lib is licesed under the [MIT License](LICENSE) This lib is licensed under the [MIT License](LICENSE).
## Contributors ## Contributors
If you should encaunter a bug or a missing feature dont hessitate to open an issue or even submit a pull-request. If you should encounter a bug or a missing feature don't hesitate to open an issue or even submit a pull-request.
Special thx to [nhh](https://github.com/nhh) and [dnltinney](https://github.com/dnltinney) for the great help debugging this lib. Special thx to [nhh](https://github.com/nhh) and [dnltinney](https://github.com/dnltinney) for the great help debugging this lib.

View file

@ -7,6 +7,8 @@ import (
"testing" "testing"
) )
const password = "password"
func startTestServer(fn func(net.Conn, *bytes.Buffer)) (string, error) { func startTestServer(fn func(net.Conn, *bytes.Buffer)) (string, error) {
listener, err := net.Listen("tcp", "127.0.0.1:0") listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil { if err != nil {
@ -36,7 +38,7 @@ func startTestServer(fn func(net.Conn, *bytes.Buffer)) (string, error) {
if err != nil { if err != nil {
return return
} }
if string(str[:len(str)-1]) != "blerg" { if string(str[:len(str)-1]) != password {
requestID = -1 requestID = -1
} }
@ -96,7 +98,7 @@ func TestAuth(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
rc, err := Dial(addr, "blerg") rc, err := Dial(addr, password)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -118,7 +120,7 @@ func TestMultipacket(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
rc, err := Dial(addr, "blerg") rc, err := Dial(addr, password)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -144,7 +146,7 @@ func TestMultipacket(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
rc, err := Dial(addr, "blerg") rc, err := Dial(addr, password)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -172,7 +174,7 @@ func TestMultipacket(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
rc, err := Dial(addr, "blerg") rc, err := Dial(addr, password)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }