derp: change NewClient constructor to an option pattern

(The NewMeshClient constructor I added recently was gross in
retrospect at call sites, especially when it wasn't obvious that a
meshKey empty string meant a regular client)
This commit is contained in:
Brad Fitzpatrick
2020-06-04 11:40:12 -07:00
parent 4d599d194f
commit 5e0ff494a5
3 changed files with 32 additions and 10 deletions
+1 -1
View File
@@ -510,7 +510,7 @@ func newRegularClient(t *testing.T, ts *testServer, name string) *testClient {
func newTestWatcher(t *testing.T, ts *testServer, name string) *testClient {
return newTestClient(t, ts, name, func(nc net.Conn, priv key.Private, logf logger.Logf) (*Client, error) {
brw := bufio.NewReadWriter(bufio.NewReader(nc), bufio.NewWriter(nc))
c, err := NewMeshClient(priv, nc, brw, logf, "mesh-key")
c, err := NewClient(priv, nc, brw, logf, MeshKey("mesh-key"))
if err != nil {
return nil, err
}