update name

This commit is contained in:
Dan Ballard 2018-11-21 15:10:02 -08:00
parent fd70341dff
commit ff54059111
6 changed files with 12 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ type Server struct {
// TODO: surface errors // TODO: surface errors
// TODO: handle HUP/KILL signals to exit and close Tor gracefully // TODO: handle HUP/KILL signals to exit and close Tor gracefully
// TODO: handle user input to exit // 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 s.config = serverConfig
cwtchserver := new(application.RicochetApplication) cwtchserver := new(application.RicochetApplication)
s.metricsPack.Start(cwtchserver, serverConfig.ConfigDir, s.config.ServerReporting.LogMetricsToFile) s.metricsPack.Start(cwtchserver, serverConfig.ConfigDir, s.config.ServerReporting.LogMetricsToFile)