Merge branch 'acn' of dan/cwtch into master

This commit is contained in:
erinn 2018-11-22 00:26:26 +00:00 committed by Gogs
commit d06b68d001
6 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@ import (
type application struct {
peers map[string]peer.CwtchPeer
mn connectivity.Mixnet
mn connectivity.ACN
directory string
mutex sync.Mutex
primaryonion string
@ -41,7 +41,7 @@ type Application interface {
}
// NewApp creates a new app with some environment awareness and initializes a Tor Manager
func NewApp(mn connectivity.Mixnet, appDirectory string) Application {
func NewApp(mn connectivity.ACN, appDirectory string) Application {
log.Printf("NewApp(%v)\n", appDirectory)
app := &application{peers: make(map[string]peer.CwtchPeer), storage: make(map[string]storage.ProfileStore), directory: appDirectory, mn: mn}
os.Mkdir(path.Join(app.directory, "profiles"), 0700)

View File

@ -15,11 +15,11 @@ type Manager struct {
serverConnections map[string]*PeerServerConnection
lock sync.Mutex
breakChannel chan bool
mn connectivity.Mixnet
mn connectivity.ACN
}
// NewConnectionsManager creates a new instance of Manager.
func NewConnectionsManager(mn connectivity.Mixnet) *Manager {
func NewConnectionsManager(mn connectivity.ACN) *Manager {
m := new(Manager)
m.mn = mn
m.peerConnections = make(map[string]*PeerPeerConnection)

View File

@ -23,11 +23,11 @@ type PeerPeerConnection struct {
profile *model.Profile
dataHandler func(string, []byte) []byte
aif application.ApplicationInstanceFactory
mn connectivity.Mixnet
mn connectivity.ACN
}
// NewPeerPeerConnection creates a new peer connection for the given hostname and profile.
func NewPeerPeerConnection(mn connectivity.Mixnet, peerhostname string, profile *model.Profile, dataHandler func(string, []byte) []byte, aif application.ApplicationInstanceFactory) *PeerPeerConnection {
func NewPeerPeerConnection(mn connectivity.ACN, peerhostname string, profile *model.Profile, dataHandler func(string, []byte) []byte, aif application.ApplicationInstanceFactory) *PeerPeerConnection {
ppc := new(PeerPeerConnection)
ppc.mn = mn
ppc.PeerHostname = peerhostname

View File

@ -23,13 +23,13 @@ type PeerServerConnection struct {
Server string
state ConnectionState
connection *connection.Connection
mn connectivity.Mixnet
mn connectivity.ACN
GroupMessageHandler func(string, *protocol.GroupMessage)
}
// NewPeerServerConnection creates a new Peer->Server outbound connection
func NewPeerServerConnection(mn connectivity.Mixnet, serverhostname string) *PeerServerConnection {
func NewPeerServerConnection(mn connectivity.ACN, serverhostname string) *PeerServerConnection {
psc := new(PeerServerConnection)
psc.mn = mn
psc.Server = serverhostname

View File

@ -28,7 +28,7 @@ type cwtchPeer struct {
connection.AutoConnectionHandler
Profile *model.Profile
app *application.RicochetApplication
mn connectivity.Mixnet
mn connectivity.ACN
mutex sync.Mutex
connectionsManager *connections.Manager
dataHandler func(string, []byte) []byte
@ -40,7 +40,7 @@ type cwtchPeer struct {
// CwtchPeer provides us with a way of testing systems built on top of cwtch without having to
// directly implement a cwtchPeer.
type CwtchPeer interface {
Init(connectivity.Mixnet)
Init(connectivity.ACN)
PeerWithOnion(string) *connections.PeerPeerConnection
InviteOnionToGroup(string, string) error
@ -90,7 +90,7 @@ func FromProfile(profile *model.Profile) CwtchPeer {
}
// Init instantiates a cwtchPeer
func (cp *cwtchPeer) Init(mn connectivity.Mixnet) {
func (cp *cwtchPeer) Init(mn connectivity.ACN) {
cp.mn = mn
cp.connectionsManager = connections.NewConnectionsManager(cp.mn)
go cp.connectionsManager.AttemptReconnections()

View File

@ -23,7 +23,7 @@ type Server struct {
// TODO: surface errors
// TODO: handle HUP/KILL signals to exit and close Tor gracefully
// TODO: handle user input to exit
func (s *Server) Run(mn connectivity.Mixnet, serverConfig Config) {
func (s *Server) Run(mn connectivity.ACN, serverConfig Config) {
s.config = serverConfig
cwtchserver := new(application.RicochetApplication)
s.metricsPack.Start(cwtchserver, serverConfig.ConfigDir, s.config.ServerReporting.LogMetricsToFile)