Commit graph

265 commits

Author SHA1 Message Date
Jonathan Barrow
d770a11b34
Forgot to run go mod tidy 2023-07-24 14:57:12 -04:00
Jonathan Barrow
73c23905e5
Updated go modules 2023-07-24 14:50:16 -04:00
Jonathan Barrow
d4c278e299
Simplify StreamIn.ReadMap to only use one switch 2023-07-24 14:49:53 -04:00
Jonathan Barrow
eeed43b4da
Fixed StreamIn.ReadMap failing to read Variant types 2023-07-24 14:39:04 -04:00
Jonathan Barrow
643ed8d44d
Added List<Buffer> read and write methods 2023-07-22 13:41:52 -04:00
Jonathan Barrow
b5b1381f95
Added StreamOut.WriteListStationURL 2023-07-21 21:42:16 -04:00
Jonathan Barrow
e57bba0665
Make NewServer use NewNEXVersion in SetDefaultNEXVersion 2023-07-12 16:31:38 -04:00
Jonathan Barrow
b4521a7879
Added NAT Traversal protocol version 2023-07-12 16:30:03 -04:00
Jonathan Barrow
981504d417
Fixed SetDefaultNEXVersion setting all versions to the same pointer 2023-07-12 16:27:10 -04:00
Jonathan Barrow
a3b28f6ad2
Added Copy method to NEXVersion and NewPatchedNEXVersion/NewNEXVersion functions 2023-07-12 16:25:42 -04:00
Jonathan Barrow
b4f7414f0c
Added String and FormatToString methods to all types 2023-06-29 17:44:59 -04:00
Jonathan Barrow
685a41b101
Updated library versions 2023-06-29 17:44:06 -04:00
Jonathan Barrow
6e9137610b
Merge pull request #31 from DaniElectra/rvconnectiondata
Add NEX version check to RVConnectionData
2023-06-21 16:57:05 -04:00
Daniel López Guimaraes
def33b948e
Fix some typos 2023-06-21 21:49:33 +01:00
Daniel López Guimaraes
b0f07b5924
Change RVConnectionData.time to DateTime
Also set structure version 1 if NEX version is 3.5+
2023-06-21 21:48:55 +01:00
Daniel López Guimaraes
9daf03e6a9
Add NEX version check to RVConnectionData
The time parameter is only present since NEX 3.5
2023-06-20 23:22:07 +01:00
Jonathan Barrow
81594ad489
Added all missing Stream read/write methods for number types 2023-06-09 12:53:57 -04:00
Jonathan Barrow
eebdf279c6
StreamOut.WriteStructure() now writes the structure version 2023-06-08 18:51:05 -04:00
Jonathan Barrow
8a4a2aedba
Added missing error checks 2023-06-07 23:18:05 -04:00
Jonathan Barrow
1d93125098
Update PRUDPv1 magic comment 2023-06-07 23:13:41 -04:00
Jonathan Barrow
0c4508e64f
All relevant methods now return errors, and all errors are now checked 2023-06-07 23:12:13 -04:00
Jonathan Barrow
3166aa974c
Added structure version to structure type 2023-06-07 13:41:15 -04:00
Jonathan Barrow
0a47838d53
Merge pull request #30 from DaniElectra/map
Add Bytes() to Variant and implement ReadMap() and WriteMap()
2023-06-06 11:20:02 -04:00
Daniel López Guimaraes
39045e2650
Revert ReadMap() to original implementation
And reimplement WriteMap() with less arguments.
2023-06-06 15:52:36 +01:00
Daniel López Guimaraes
062470d47a
Implement ReadMap() and WriteMap()
Maps were not completely implemented before and we only had the ability
to read them from streams. In order to support every stream type on
maps, let the user define the read or write function to call for the key
and value.

Since we have to allow every fucnction type, pass the functions as
`interface{}` and call them using reflect. Note that ReadMap() currently
does not support every stream type, like structures, because we would
have to get the structure we want to read and pass it as an argument
when making the call.
2023-06-05 20:11:38 +01:00
Daniel López Guimaraes
6eac68ab1a
Add Bytes() to Variant and minor changes
In order to implement the stream properly, add ReadFloat64LE() to
StreamIn and other required functions for the Variant.
2023-06-05 20:09:31 +01:00
Jonathan Barrow
c64925b6e1
Merge pull request #29 from DaniElectra/copy
Use structure.Copy() on DataHolder read
2023-05-28 10:19:43 -04:00
Daniel López Guimaraes
7eeae41f05
Fix comments linting issues 2023-05-27 23:33:52 +01:00
Daniel López Guimaraes
92116b2857
Use structure.Copy() instead of reflect
Also use Copy() upon reading data holders.
2023-05-27 23:12:32 +01:00
Jonathan Barrow
4113d234a0
Added a real Variant type and updated StreamIn.ReadVariant 2023-05-21 23:41:42 -04:00
Jonathan Barrow
7e4b98cfe2
Fixed RVConnectionData specialProtocols slice not being copied correctly 2023-05-21 18:26:56 -04:00
Jonathan Barrow
e39ebbe64c
Add Copy and Equals methods to all types 2023-05-21 18:22:52 -04:00
Jonathan Barrow
0801d7539c
Added Equals method to StructureInterface and required types 2023-05-21 17:32:48 -04:00
Jonathan Barrow
63f6a23cce
Added Copy method to StructureInterface and required types 2023-05-21 17:20:07 -04:00
Jonathan Barrow
b153233c91
Updated go modules 2023-05-21 17:09:30 -04:00
Jonathan Barrow
5dc71db489
Removed hierarchy tree system in favor of a single parentType field 2023-05-21 17:09:10 -04:00
Jonathan Barrow
771e66e9f2
Merge pull request #28 from DaniElectra/dataholder
Fix various DataHolder issues
2023-05-21 16:10:57 -04:00
Daniel López Guimaraes
031f69c87b
Fix various DataHolder issues
While the hierarchy implementation from #27 works in some cases, it
has two problems:

- It only works for NEX version <3.5, as we aren't writing the stucture
  header. This isn't exactly a problem of the PR, as it was already
  wrong.
- It only checks for one layer of hierarchy, because there is no
  recursion applied.

Solve this by using `WriteStructure()` instead of getting the raw bytes,
since the object data is already a `StructureInterface`.

On `ExtractFromStream()` there is no need to use reflect as the object
data will be the correct structure. Using reflect also breaks with
hierarchy for unknown reasons, so just pass the dataType to
`ReadStructure()`.

Also fix a bug where the data holder is written twice when calling
`WriteDataHolder()` because of reusing the same stream on
`dataHolder.Bytes()`.
2023-05-21 14:58:55 +01:00
Jonathan Barrow
05fa2c0ae7
Merge pull request #27 from shutterbug2000/dataholder-hierarchy
Add Hierarchy handling to DataHolder
2023-05-21 01:28:20 -04:00
shutterbug2000
bdf790db45 Add Hierarchy handling to DataHolder 2023-05-21 00:26:05 -05:00
Jonathan Barrow
e4f02878e7
Merge pull request #26 from shutterbug2000/station-url-change 2023-05-20 09:45:29 -04:00
shutterbug2000
6590659477 Store both session URLs on the Client object
This removes the need for a DB to handle this
2023-05-20 03:42:53 -05:00
Jonathan Barrow
41568c0d6f
Merge pull request #25 from DaniElectra/hierarchy 2023-05-19 22:37:53 -04:00
Daniel López Guimaraes
4276ce2967
Revert hierarchy on nex.Structure
The value is private so it can't be edited.
2023-05-19 21:22:13 +01:00
Daniel López Guimaraes
f6cb847021
Write structure hierarchy on WriteStructure
Also add hierarchy to nex.Structure and rename class to parent on
ReadStructure.
2023-05-19 21:05:59 +01:00
Jonathan Barrow
9c78ebcef9
Merge pull request #24 from DaniElectra/hpp
Add HPP protocol support
2023-04-23 14:15:11 -04:00
Daniel López Guimaraes
a97e9e6b19
Add getter for PasswordFromPIDFunction
This allows the common authentication protocol to reuse this function
and avoid confusion.
2023-04-23 18:05:19 +01:00
Daniel López Guimaraes
98fc727028
Add HPP protocol support
Implement an HTTP server that supports HPP requests, and add a fake
packet `HPPPacket` that allows interaction with existing code.

The `RMCResponse` won't write the protocol ID bytes if it's set to zero.
This allows support for HPP, as the RMC responses of this protocol don't
include the protocol ID.
2023-04-23 16:00:28 +01:00
Jonathan Barrow
0b5e809431
Merge pull request #23 from PretendoNetwork/kick-all
KickAll command + "graceful" kick
2023-04-15 22:49:34 -04:00
shutterbug2000
b1d7004d6b remove stray version assignment 2023-04-15 21:41:12 -05:00