Fixing ineffassign and misspell #200
|
@ -96,6 +96,10 @@ func (app *application) LoadProfiles(password string) error {
|
|||
// TODO: Per profile eventBus
|
||||
profileStore, err := storage.NewProfileStore(app.eventBus, path.Join(app.directory, "profiles", file.Name()), password)
|
||||
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
err = profileStore.Load()
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
|
@ -360,6 +360,11 @@ func main() {
|
|||
fmt.Print("Enter a password to decrypt the profile: ")
|
||||
bytePassword, err := terminal.ReadPassword(int(syscall.Stdin))
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("\nError loading profiles: %v\n", err)
|
||||
continue
|
||||
}
|
||||
|
||||
err = app.LoadProfiles(string(bytePassword))
|
||||
if err == nil {
|
||||
app.LaunchPeers()
|
||||
|
|
|
@ -32,7 +32,7 @@ func main() {
|
|||
alice.Init(acn, eventBus)
|
||||
alice.Listen()
|
||||
|
||||
// For every new Data Packet Alice recieved she will Print it out.
|
||||
// For every new Data Packet Alice received she will Print it out.
|
||||
for {
|
||||
event := queue.Next()
|
||||
log.Printf(log.LevelInfo, "Received %v from %v: %s", event.EventType, event.Data["Onion"], event.Data["Data"])
|
||||
|
|
|
@ -99,7 +99,7 @@ func (cp *cwtchPeer) Init(acn connectivity.ACN, eventBus *event.Manager) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Would be nice if ProtocolEngine did not need to explictly be given the Private Key.
|
||||
// TODO: Would be nice if ProtocolEngine did not need to explicitly be given the Private Key.
|
||||
cp.engine = connections.NewProtocolEngine(cp.Profile.Ed25519PrivateKey, acn, eventBus, blockedPeers)
|
||||
cp.engine.Identity = identity.InitializeV3(cp.Profile.Name, &cp.Profile.Ed25519PrivateKey, &cp.Profile.Ed25519PublicKey)
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ func (cp *cwtchPeer) JoinServer(onion string) {
|
|||
cp.eventBus.Publish(event.NewEvent(event.JoinServer, map[event.Field]string{event.GroupServer: onion}))
|
||||
}
|
||||
|
||||
// SendMessageToGroup attemps to sent the given message to the given group id.
|
||||
// SendMessageToGroup attempts to sent the given message to the given group id.
|
||||
func (cp *cwtchPeer) SendMessageToGroup(groupid string, message string) error {
|
||||
group := cp.Profile.GetGroupByGroupID(groupid)
|
||||
if group == nil {
|
||||
|
|
|
@ -135,7 +135,7 @@ func (m *Manager) ClosePeerConnection(onion string) {
|
|||
m.lock.Unlock()
|
||||
}
|
||||
|
||||
// Shutdown closes all connections under managment (freeing their goroutines)
|
||||
// Shutdown closes all connections under management (freeing their goroutines)
|
||||
func (m *Manager) Shutdown() {
|
||||
m.breakChannel <- true
|
||||
m.lock.Lock()
|
||||
|
|
|
@ -211,7 +211,7 @@ func (e *Engine) JoinServer(onion string) {
|
|||
e.connectionsManager.ManageServerConnection(onion, e.ReceiveGroupMessage)
|
||||
}
|
||||
|
||||
// SendMessageToGroup attemps to sent the given message to the given group id.
|
||||
// SendMessageToGroup attempts to sent the given message to the given group id.
|
||||
func (e *Engine) SendMessageToGroup(server string, ct []byte, sig []byte) error {
|
||||
psc := e.connectionsManager.GetPeerServerConnectionForOnion(server)
|
||||
if psc == nil {
|
||||
|
|
|
@ -51,7 +51,7 @@ func (sg *Guard) GenerateChallenge(channelID int32) []byte {
|
|||
func (sg *Guard) SolveChallenge(challenge []byte, message []byte) []byte {
|
||||
solved := false
|
||||
var spamguard [24]byte
|
||||
sum := sha256.Sum256([]byte{})
|
||||
var sum [32]byte
|
||||
solve := make([]byte, len(challenge)+len(message)+len(spamguard))
|
||||
for !solved {
|
||||
|
||||
|
|
|
@ -18,6 +18,6 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
// ConnectionStateName allows conversaion of states to their string representations
|
||||
// ConnectionStateName allows conversion of states to their string representations
|
||||
ConnectionStateName = []string{"Disconnected", "Connecting", "Connected", "Authenticated", "Failed", "Killed"}
|
||||
)
|
||||
|
|
|
@ -105,7 +105,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
|
|||
t.Fatalf("Could not start Tor: %v", err)
|
||||
}
|
||||
|
||||
// ***** Cwtch Server managment *****
|
||||
// ***** Cwtch Server management *****
|
||||
var server *cwtchserver.Server
|
||||
|
||||
serverOnline := false
|
|
@ -14,3 +14,11 @@ go list ./... | xargs golint
|
|||
|
||||
echo "Time to format"
|
||||
gofmt -l -s -w .
|
||||
|
||||
# ineffassign (https://github.com/gordonklaus/ineffassign)
|
||||
echo "Checking for ineffectual assignment of errors (unchecked errors...)"
|
||||
ineffassign .
|
||||
|
||||
# misspell (https://github.com/client9/misspell)
|
||||
echo "Checking for misspelled words..."
|
||||
misspell . | grep -v "vendor/" | grep -v "go.sum" | grep -v ".idea"
|
||||
|
|
Loading…
Reference in New Issue