diff --git a/application.go b/application.go index e2aabb9..5efc9be 100644 --- a/application.go +++ b/application.go @@ -1,6 +1,5 @@ package tapir - // Application defines the interface for all Tapir Applications type Application interface { NewInstance() Application diff --git a/cmd/main.go b/cmd/main.go index 3c67bd7..a4b1ddc 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -69,13 +69,13 @@ func client(acn connectivity.ACN, key ed25519.PublicKey) { var client tapir.Service client = new(tapir.BaseOnionService) client.Start(acn, sk, id) - cid,_ := client.Connect(utils.GetTorV3Hostname(key), SimpleApp{}) + cid, _ := client.Connect(utils.GetTorV3Hostname(key), SimpleApp{}) // Once connected, it shouldn't take long to authenticate and run the application. So for the purposes of this demo // we will wait a little while then exit. time.Sleep(time.Second * 5) - conn,_ := client.GetConnection(cid) + conn, _ := client.GetConnection(cid) log.Debugf("Client has Auth: %v", conn.HasCapability(tapir.AuthCapability)) os.Exit(0) diff --git a/service.go b/service.go index fe06f37..746fa0d 100644 --- a/service.go +++ b/service.go @@ -15,7 +15,6 @@ import ( "sync" ) - // Service defines the interface for a Tapir Service type Service interface { Start(acn connectivity.ACN, privateKey ed25519.PrivateKey, identity identity.Identity) @@ -24,7 +23,6 @@ type Service interface { GetConnection(connectionID string) (*Connection, error) } - // Connection defines a Tapir Connection type Connection struct { hostname string @@ -99,7 +97,6 @@ func (c *Connection) SetEncryptionKey(key [32]byte) { c.encrypted = true } - // Send writes a given message to a Tapir packet (of 1024 bytes in length). func (c *Connection) Send(message []byte) { @@ -129,7 +126,6 @@ type BaseOnionService struct { privateKey ed25519.PrivateKey } - // Start initializes a BaseOnionService with a given private key and identity // The private key is needed to initialize the Onion listen socket, ideally we could just pass an Identity in here. func (s *BaseOnionService) Start(acn connectivity.ACN, sk ed25519.PrivateKey, id identity.Identity) { @@ -140,10 +136,9 @@ func (s *BaseOnionService) Start(acn connectivity.ACN, sk ed25519.PrivateKey, id s.privateKey = sk } - // GetConnection returns a connection for a given hostname. func (s *BaseOnionService) GetConnection(connectionID string) (*Connection, error) { - conn,ok := s.connections.Load(connectionID) + conn, ok := s.connections.Load(connectionID) if !ok { return nil, errors.New("no connection found") }