This library is designed to simplify interaction with the NYM protocol for nym-client. It implements a basic set of commands for sending and receiving messages to/from mixnet.
- Using Gorilla WebSocket
- Text Protocol (JSON) support
- Binary Protocol support
- Support for the user protocol in the body of the binary message
-
The library requires an active connection to the websocket client. The simple installation and launch of the
nym-client
is described in the official docs -> link -
Tested with nym-client version
1.1.32
-
Importing a dependency
Use the standard Go tools to install dependencies:
go get github.com/craftdome/go-nym
Importing the basic package:
import "github.com/craftdome/go-nym"
- Remember, if you plan to give access to
nym-client
connect from the outside (for this you should specify the ip of the external network interface of your machine), thenym-client
doesn't have a connection auth function. - Only 1 connection is allowed at a time.
- If you need an external connection, use a local networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12) instead of a global unicast one to increase security.
- First, you need to
init
the connection client with the nym-client address. We copy the connectionaddress:port
from the console after running the nym-client. By default it'slocalhost:1977
, or in my case192.168.88.4:1977
.
Lines 21 to 22 in 17a1c03
- Connection establishing with the
nym-client
.
Lines 24 to 27 in 17a1c03
- We turn on listening to incoming messages, which we then extract through the
Messages()
chan.
Lines 30 to 54 in 17a1c03
- Getting your nym-client address (SelfAddress).
Lines 57 to 59 in 17a1c03
- Sending a message (Send).
Lines 61 to 66 in 17a1c03
- Sending a SURB message to receive an anonymous response (SendAnonymous).
Lines 68 to 74 in 17a1c03
- Sending a reply to the SendAnonymous message (Reply).
Lines 76 to 81 in 17a1c03
- We close the connection with the
nym-client
after the interrupt (sigint/sigkill) and wait for the reading gorutine sentdone
signal.
Lines 83 to 91 in 17a1c03
Below is a list of the developer's mixnodes. If you are looking for a node for delegating tokens, you can take a closer look at my options.