psanford / wormhole-william

End-to-end encrypted file transfer. A magic wormhole CLI and API in Go (golang).
MIT License
1.07k stars 54 forks source link

Drop reflection in rendezvous/client.go #84

Closed Jacalz closed 2 years ago

Jacalz commented 2 years ago

This moves the rendezvous_value: tag to instead be an interface with a getter method. The tag is used in other parts of the code for now but should be possible to remove after more work has landed.

The MsgMap from the internal package was split into two. One in the test, for testing the specific values, and one in the rendezvousservertest for testing the json marshalling (the latter using interface{} instead of the new type). This avoids compiling in the map into binaries given that it was never used outside of testing.

For #83

Jacalz commented 2 years ago

There is a test that I don't understand why it is failing, but I have managed to remove reflect entirely from the client.go file now. More work is needed in rendezvousservertest as well as one more file that still uses reflect. The remaining work is a bit trickier but this should be a good start.

Jacalz commented 2 years ago

This is basically done. I have not managed to remove the rendezvous_value tag entirely as rendezvousservertest still uses it. I tried to remove it and change that test but it seems like it just hangs forever if it doesn't work directly. With this done, it leaves just one file for the API and two files for testing.