Browse Source

ineffassign and misspell

ineffassign
Sarah Jamie Lewis 1 year ago
parent
commit
2239463512
10 changed files with 25 additions and 8 deletions
  1. +4
    -0
      app/app.go
  2. +5
    -0
      app/cli/main.go
  3. +1
    -1
      app/peer/alice/alice.go
  4. +2
    -2
      peer/cwtch_peer.go
  5. +1
    -1
      protocol/connections/connectionsmanager.go
  6. +1
    -1
      protocol/connections/engine.go
  7. +1
    -1
      protocol/connections/spam/spamguard.go
  8. +1
    -1
      protocol/connections/state.go
  9. +1
    -1
      testing/cwtch_peer_server_integration_test.go
  10. +8
    -0
      testing/quality.sh

+ 4
- 0
app/app.go View File

@@ -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


+ 5
- 0
app/cli/main.go View File

@@ -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()


+ 1
- 1
app/peer/alice/alice.go View File

@@ -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"])


+ 2
- 2
peer/cwtch_peer.go View File

@@ -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 {


+ 1
- 1
protocol/connections/connectionsmanager.go View File

@@ -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()


+ 1
- 1
protocol/connections/engine.go View File

@@ -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 {


+ 1
- 1
protocol/connections/spam/spamguard.go View File

@@ -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 {



+ 1
- 1
protocol/connections/state.go View File

@@ -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"}
)

testing/cwtch_peer_server_intergration_test.go → testing/cwtch_peer_server_integration_test.go View File

@@ -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

+ 8
- 0
testing/quality.sh View File

@@ -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…
Cancel
Save