Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
outdead committed Nov 15, 2024
1 parent 7d2db9a commit aa0387b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ jobs:
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Test
run: go test -v ./...

- name: Build
run: go build -v .

- name: Update coverage report
uses: ncruces/go-coverage-report@main
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rcon
[![GitHub Build](https://github.com/gorcon/rcon/workflows/build/badge.svg)](https://github.com/gorcon/rcon/actions)
[![Coverage](https://gocover.io/_badge/github.com/gorcon/rcon?0 "coverage")](https://gocover.io/github.com/gorcon/rcon)
[![Go Coverage](https://github.com/USER/REPO/wiki/coverage.svg)](https://raw.githack.com/wiki/gorcon/rcon/coverage.html)
[![Go Report Card](https://goreportcard.com/badge/github.com/gorcon/rcon)](https://goreportcard.com/report/github.com/gorcon/rcon)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/gorcon/rcon)

Expand Down Expand Up @@ -33,8 +33,8 @@ See [Changelog](CHANGELOG.md) for release details.
package main

import (
"log"
"fmt"
"log"

"github.com/gorcon/rcon"
)
Expand All @@ -55,13 +55,49 @@ func main() {
}
```

### With an existing net.Conn
If you wish to initialize a RCON connection with an already initialized net.Conn, you can use the `Open` function:
```go
package main

import (
"fmt"
"log"
"net"

"github.com/gorcon/rcon"
)

func main() {
netConn, err := net.Dial("tcp", "127.0.0.1:16260")
if err != nil {
// Failed to open TCP connection to the server.
log.Fatalf("expected nil got error: %s", err)
}
defer netConn.Close()

conn, err := rcon.Open(netConn, "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
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.
Expand Down

0 comments on commit aa0387b

Please sign in to comment.