forked from cwtch.im/cwtch
Merge branch 'tor' of cwtch.im/cwtch into master
This commit is contained in:
commit
44384d1cec
|
@ -9,6 +9,7 @@ import (
|
||||||
// Application is a facade over a cwtchPeer that provides some wrapping logic.
|
// Application is a facade over a cwtchPeer that provides some wrapping logic.
|
||||||
type Application struct {
|
type Application struct {
|
||||||
Peer peer.CwtchPeerInterface
|
Peer peer.CwtchPeerInterface
|
||||||
|
TorManager *tor.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewProfile creates a new cwtchPeer with a given name.
|
// NewProfile creates a new cwtchPeer with a given name.
|
||||||
|
@ -42,10 +43,11 @@ func (app *Application) SetProfile(filename string, password string) error {
|
||||||
app.Peer = profile
|
app.Peer = profile
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
||||||
_, err := tor.NewTorManager(9050, 9051)
|
tm, err := tor.NewTorManager(9050, 9051)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
app.TorManager = tm
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
err := app.Peer.Listen()
|
err := app.Peer.Listen()
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -428,7 +429,16 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if profilefile != "" {
|
if profilefile != "" {
|
||||||
|
if app.Peer != nil {
|
||||||
app.Peer.Save(profilefile)
|
app.Peer.Save(profilefile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if app.TorManager != nil {
|
||||||
|
fmt.Println("Shutting down Tor process...")
|
||||||
|
app.TorManager.Shutdown()
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,14 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/yawning/bulb"
|
"github.com/yawning/bulb"
|
||||||
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"os/user"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -15,6 +20,7 @@ import (
|
||||||
type Manager struct {
|
type Manager struct {
|
||||||
socksPort int
|
socksPort int
|
||||||
controlPort int
|
controlPort int
|
||||||
|
process *exec.Cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTorManager Instantiates a new connection manager, returns non-nil error if it fails to connect to a tor daemon on the given ports.
|
// NewTorManager Instantiates a new connection manager, returns non-nil error if it fails to connect to a tor daemon on the given ports.
|
||||||
|
@ -23,6 +29,39 @@ func NewTorManager(socksPort int, controlPort int) (*Manager, error) {
|
||||||
torManager.socksPort = socksPort
|
torManager.socksPort = socksPort
|
||||||
torManager.controlPort = controlPort
|
torManager.controlPort = controlPort
|
||||||
err := torManager.TestConnection()
|
err := torManager.TestConnection()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
usr, err := user.Current()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
torrc := path.Join(usr.HomeDir, ".cwtch", "torrc")
|
||||||
|
if _, err := os.Stat(torrc); os.IsNotExist(err) {
|
||||||
|
|
||||||
|
os.MkdirAll(path.Join(usr.HomeDir, ".cwtch"), 0700)
|
||||||
|
|
||||||
|
file, err := os.Create(torrc)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fmt.Fprintf(file, "SOCKSPort %d\nControlPort %d\n", socksPort, controlPort)
|
||||||
|
file.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := exec.Command("tor", "-f", torrc)
|
||||||
|
err = cmd.Start()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fmt.Printf("\nWaiting to connect to Tor Proxy...\n")
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
torManager.process = cmd
|
||||||
|
err = torManager.TestConnection()
|
||||||
|
return torManager, err
|
||||||
|
}
|
||||||
|
|
||||||
return torManager, err
|
return torManager, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +74,15 @@ const (
|
||||||
proxyStatusTimeout
|
proxyStatusTimeout
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Shutdown kills the managed Tor Process
|
||||||
|
func (tm *Manager) Shutdown() {
|
||||||
|
if tm.process != nil {
|
||||||
|
if err := tm.process.Process.Kill(); err != nil {
|
||||||
|
log.Fatal("failed to kill process: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Detect whether a proxy is connectable and is a Tor proxy
|
// Detect whether a proxy is connectable and is a Tor proxy
|
||||||
func checkTorProxy(proxyAddress string) proxyStatus {
|
func checkTorProxy(proxyAddress string) proxyStatus {
|
||||||
// A trick to do this without making an outward connection is,
|
// A trick to do this without making an outward connection is,
|
||||||
|
|
|
@ -5,8 +5,8 @@ import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"golang.org/x/crypto/nacl/secretbox"
|
"golang.org/x/crypto/nacl/secretbox"
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"encoding/asn1"
|
"encoding/asn1"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"golang.org/x/crypto/ed25519"
|
"golang.org/x/crypto/ed25519"
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package connections
|
package connections
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cwtch.im/cwtch/model"
|
||||||
"cwtch.im/cwtch/peer/peer"
|
"cwtch.im/cwtch/peer/peer"
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go"
|
"git.openprivacy.ca/openprivacy/libricochet-go"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/connection"
|
"git.openprivacy.ca/openprivacy/libricochet-go/connection"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/identity"
|
"git.openprivacy.ca/openprivacy/libricochet-go/identity"
|
||||||
"cwtch.im/cwtch/model"
|
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
|
|
||||||
func TestCwtchPeerGenerate(t *testing.T) {
|
func TestCwtchPeerGenerate(t *testing.T) {
|
||||||
|
|
||||||
alice := NewCwtchPeer("alice","testpass")
|
alice := NewCwtchPeer("alice", "testpass")
|
||||||
alice.Save("./test_profile")
|
alice.Save("./test_profile")
|
||||||
|
|
||||||
aliceLoaded, err := LoadCwtchPeer("./test_profile","testpass")
|
aliceLoaded, err := LoadCwtchPeer("./test_profile", "testpass")
|
||||||
if err != nil || aliceLoaded.GetProfile().Name != "alice" {
|
if err != nil || aliceLoaded.GetProfile().Name != "alice" {
|
||||||
t.Errorf("something went wrong saving and loading profiles %v %v", err, aliceLoaded)
|
t.Errorf("something went wrong saving and loading profiles %v %v", err, aliceLoaded)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@ package fetch
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CwtchPeerFetchChannel is the peer implementation of the im.cwtch.server.fetch
|
// CwtchPeerFetchChannel is the peer implementation of the im.cwtch.server.fetch
|
||||||
|
|
|
@ -2,9 +2,9 @@ package fetch
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,10 +3,10 @@ package listen
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CwtchPeerListenChannel is the peer implementation of im.cwtch.server.listen
|
// CwtchPeerListenChannel is the peer implementation of im.cwtch.server.listen
|
||||||
|
|
|
@ -2,9 +2,9 @@ package listen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,10 +2,10 @@ package peer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ package peer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"cwtch.im/cwtch/protocol/spam"
|
"cwtch.im/cwtch/protocol/spam"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CwtchPeerSendChannel is the peer implementation of im.cwtch.server.send
|
// CwtchPeerSendChannel is the peer implementation of im.cwtch.server.send
|
||||||
|
|
|
@ -3,9 +3,9 @@ package send
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"cwtch.im/cwtch/protocol/spam"
|
"cwtch.im/cwtch/protocol/spam"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"io"
|
"io"
|
||||||
//"fmt"
|
//"fmt"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,8 +2,8 @@ package spam
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ package fetch
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CwtchServerFetchChannel implements the ChannelHandler interface for a channel of
|
// CwtchServerFetchChannel implements the ChannelHandler interface for a channel of
|
||||||
|
|
|
@ -2,9 +2,9 @@ package fetch
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ package listen
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CwtchServerListenChannel implements the ChannelHandler interface for a channel of
|
// CwtchServerListenChannel implements the ChannelHandler interface for a channel of
|
||||||
|
|
|
@ -2,9 +2,9 @@ package listen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"cwtch.im/cwtch/protocol/spam"
|
"cwtch.im/cwtch/protocol/spam"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ package send
|
||||||
import (
|
import (
|
||||||
"cwtch.im/cwtch/protocol"
|
"cwtch.im/cwtch/protocol"
|
||||||
"cwtch.im/cwtch/protocol/spam"
|
"cwtch.im/cwtch/protocol/spam"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
|
||||||
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -143,17 +143,17 @@ func TestCwtchPeerIntegration(t *testing.T) {
|
||||||
// ***** Peer setup *****
|
// ***** Peer setup *****
|
||||||
|
|
||||||
fmt.Println("Creating Alice...")
|
fmt.Println("Creating Alice...")
|
||||||
alice := peer.NewCwtchPeer("Alice","alicepass")
|
alice := peer.NewCwtchPeer("Alice", "alicepass")
|
||||||
go alice.Listen()
|
go alice.Listen()
|
||||||
fmt.Println("Alice created:", alice.GetProfile().Onion)
|
fmt.Println("Alice created:", alice.GetProfile().Onion)
|
||||||
|
|
||||||
fmt.Println("Creating Bob...")
|
fmt.Println("Creating Bob...")
|
||||||
bob := peer.NewCwtchPeer("Bob","bobpass")
|
bob := peer.NewCwtchPeer("Bob", "bobpass")
|
||||||
go bob.Listen()
|
go bob.Listen()
|
||||||
fmt.Println("Bob created:", bob.GetProfile().Onion)
|
fmt.Println("Bob created:", bob.GetProfile().Onion)
|
||||||
|
|
||||||
fmt.Println("Creating Carol...")
|
fmt.Println("Creating Carol...")
|
||||||
carol := peer.NewCwtchPeer("Carol","carolpass")
|
carol := peer.NewCwtchPeer("Carol", "carolpass")
|
||||||
go carol.Listen()
|
go carol.Listen()
|
||||||
fmt.Println("Carol created:", carol.GetProfile().Onion)
|
fmt.Println("Carol created:", carol.GetProfile().Onion)
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,7 @@ echo ""
|
||||||
echo "Linting:"
|
echo "Linting:"
|
||||||
|
|
||||||
go list ./... | xargs golint
|
go list ./... | xargs golint
|
||||||
|
|
||||||
|
|
||||||
|
echo "Time to format"
|
||||||
|
gofmt -l -s -w .
|
||||||
|
|
Loading…
Reference in New Issue