To use the Go client API to the circuit, start by importing the client package:
The first step of every circuit client application is connecting to a circuit cluster. There are two alternative methods for doing so.
If you want to connect the client to a specific circuit server with a known circuit address, then use
Dial(addr string, authkey byte) *Client
addr specifies the circuit server address (a string of the form
authkey should equal the authentication key for this cluster, or
the cluster does not use encryption and authentication.
Dial blocks until the connection is established and on success returns a client
object, which implements the
Anchor interface and represents the root of the
Dial is to fail, it will report an error by panicing.
Alternatively, if the circuit cluster supports (multicast-based) discovery,
you could use
DialDiscover to first discover a random
circuit server from the cluster and then connect to it:
DialDiscover(multicast string, authkey byte) *Client
multicast must equal the multicast discovery address for the