05aea9e665
Fix packet parsing
...
With the old implementation we skipped one byte of the body and did not read
an empty body.
Not being able to read an empty body was not the only problem with the
old implementation. It could also happen that for what ever reason an
null byte was encoded inside of it and with the old implementation we
would stop at this null and ignore the rest.
2022-02-11 17:01:46 +01:00
3e2320a5f4
Add top level package information
2022-02-07 20:58:41 +01:00
447d07372b
Fix usage example
...
- Add Close() call with defer
- Fix code not exiting on error
2022-02-07 20:33:47 +01:00
9994b2e641
Fix formatting
2022-02-07 20:32:57 +01:00
7830bfeaa5
Clarify documentation of package composition
2022-02-06 01:07:27 +01:00
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
480da5084b
Add project README.md
2021-03-07 18:30:09 +01:00
56c725b9b1
Merge pull request #1 from hamburghammer/rework
...
Refactor the internals and tests to make them more maintainable/readable.
2021-03-07 18:01:14 +01:00
460c2c6022
Add missing return documentation for errors
2021-03-07 17:58:16 +01:00
255f0240b3
Remove info for reading from a closed connection.
2021-03-07 17:56:49 +01:00
3d5e6f4e2a
Reduce init buffer size for the bytes containing the package size
2021-03-07 17:55:39 +01:00
c006c47940
Split test into subtests
2021-03-07 17:55:39 +01:00
84838f460d
Fix command length check
...
I don't know why the commoand length was limited to 1014 bytes.
Following the package documentation the body can contain 4086 bytes =
4096 (max package size) - 10 (min package size (whene the body is empty)).
https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Packet_Size
2021-03-06 16:20:39 +01:00
f3d58827cb
Add gitignore
2021-03-06 16:20:39 +01:00
dc79010e8e
Extract reading the package to own method
2021-03-06 16:20:39 +01:00
8afdb88172
Fix buffer not beeing able to hold a max size package
2021-03-06 16:20:39 +01:00
01bfc09bc0
Extract the reading of the package size to own method
2021-03-06 16:20:39 +01:00
b3d073822b
Remove return of requestID on writeCmd function
...
This is no longer nessesary because the id is giving into
the method as a param. This change removed the return of a negative
value if the command is to long. This can be a problem but it wasn't
documented...
2021-03-06 16:20:39 +01:00
a4b726260e
Move authentication to own method
...
This should reduce the size of the Dial function and make it more
readable.
2021-03-06 16:20:39 +01:00
a87cbb0926
Remove reqID from RemoteConsole
...
The only usage of the reqID field was inside the initial
auth request to prevent generation a new id.
2021-03-06 16:20:39 +01:00
82d215942e
Fix spelling
2021-03-06 16:20:39 +01:00
50ea12a2d9
Rework naming of type and field names
2021-03-06 16:20:39 +01:00
aa40eb139d
Add Drone CI setup
2021-03-06 16:19:24 +01:00
e28f399e6f
Refactor documentation and wrong package size numbers
...
Adding documentation to public functions, structs, vars and consts to
fix fmt warnings. This should make it easier to read and to use.
Additionally I tweaked the package size numbers to match the definition
from valve[1].
Ref:
- [1] https://developer.valvesoftware.com/wiki/Source_RCON_Protocol
2021-03-02 21:03:20 +01:00
c947a9057c
Add copyright holder
2021-03-02 18:40:51 +01:00
c28a83cf1f
Add go module
2021-03-02 18:39:59 +01:00
james4k
34a67ca2b2
MIT license
2021-02-22 16:48:19 -06:00
James Gray
8fbb8268b6
Renamed New() to Dial() to be more idiomatic.
2012-09-23 16:54:19 -05:00
James Gray
ab4e77e461
Fixed invalid ErrUnexpectedFormat.
...
When the response size (int32) was split between packets, Read returned
with an ErrUnexpectedFormat.
2012-09-23 16:41:40 -05:00
James Gray
989cec1929
added LocalAddr() and RemoteAddr() methods
2012-09-23 15:46:46 -05:00
James Gray
b97005dc63
fixed an unnecessary ErrUnexpectedFormat
2012-09-15 00:09:35 -05:00
James Gray
52509f3e4f
changed ErrCommandTooLong/ErrResponseTooLong messages
2012-09-04 22:46:11 -05:00
James Gray
0e7028e295
added handling of split responses
2012-09-04 22:42:40 -05:00
James Gray
57f08dedd9
fixed some small issues; added an auth test
2012-09-02 17:05:48 -05:00
James Gray
85a30b81b0
corrected the reqid atomic ops
2012-08-31 03:45:33 -05:00
James Gray
6a4a062bb0
added a Close method
2012-08-31 02:48:25 -05:00
James Gray
68c9926e00
basic, untested implementation
2012-08-31 02:42:43 -05:00