Commit graph

621 commits

Author SHA1 Message Date
Jonathan Barrow
48a9f6b538
StationURL values now uses uint32 pointers instead of strings 2023-08-15 06:45:45 -04:00
Jonathan Barrow
3ef56ce892
Merge pull request #32 from DaniElectra/reflect
Use Sprintf() for registering data holders
2023-08-06 18:24:14 -04:00
Daniel López Guimaraes
3ce17c63ea
Update go modules and change data holder registers 2023-08-06 21:10:25 +01:00
Daniel López Guimaraes
16c5f5eca9
Use crypto/rand over math/rand
Also add error handling for rand.Read()
2023-08-06 01:36:14 +01:00
Daniel López Guimaraes
11bf2a0d33
Use Sprintf() for registering data holders
This allows us to reduce usage of reflect.
2023-08-06 01:35:27 +01:00
Jonathan Barrow
64b28c3b02
Fixed StreamIn.ReadMap using the key function twice 2023-07-24 15:02:45 -04:00
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