Commit graph

501 commits

Author SHA1 Message Date
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
Jonathan Barrow
71534efa19
Added methods to Standard to get standard time values 2023-04-11 22:34:09 -04:00
Jonathan Barrow
6fb5c7d0f0
Added default NEX version to all servers 2023-04-10 22:32:12 -04:00
Jonathan Barrow
8fe373c2b1
Added type check to DataHolder reading 2023-04-10 22:26:07 -04:00
shutterbug2000
a50ff5b21c Set correct version for packets (oops lol) 2023-04-09 23:42:09 -05:00
shutterbug2000
3fcc1d44c7 Seperate kick methods for graceful and timeout 2023-04-09 23:24:05 -05:00
shutterbug2000
3c7a22f99c KickAll command + "graceful" kick 2023-04-09 02:44:51 -05:00
Jonathan Barrow
d65b2f2d4c
Added Station URL methods to StreamIn 2023-04-07 19:35:34 -04:00
Jonathan Barrow
ebc095e782
Added generic StreamIn::ReadListStructure 2023-04-07 19:32:45 -04:00
Jonathan Barrow
cd950eff9e
More consistent PRUDP method naming 2023-04-05 19:31:00 -04:00
Jonathan Barrow
86eb9b08e0
Removed SetNexVersion and added methods for setting specific NEX protocol versions 2023-04-05 19:28:18 -04:00
Jonathan Barrow
67e64f3fe7
Merge pull request #22 from hauntii/feature-write-date-time
Add WriteDateTime for clarity
2023-04-02 00:05:02 -04:00
light
127f685036 Add WriteDateTime for clarity 2023-04-01 17:02:22 -04:00
Jonathan Barrow
21416aab1c
Added BE for uint32 and uint64 on StreamIn 2023-03-30 00:52:33 -04:00
Jonathan Barrow
935836805e
Merge branch 'master' of https://github.com/PretendoNetwork/nex-go 2023-03-26 12:29:26 -04:00