Commit dc7bac01 authored by Sofía Celi's avatar Sofía Celi

Fix lint

parent 846328a7
......@@ -25,8 +25,8 @@ import (
"time"
"github.com/katzenpost/core/crypto/cert"
"github.com/katzenpost/core/pki"
"github.com/katzenpost/core/epochtime"
"github.com/katzenpost/core/pki"
"github.com/katzenpost/core/sphinx/constants"
"github.com/ugorji/go/codec"
"golang.org/x/net/idna"
......@@ -35,6 +35,7 @@ import (
const (
nodeDescriptorVersion = "v0"
)
var (
// CertificateExpiration is the time a descriptor certificate will be valid for.
CertificateExpiration = (epochtime.Period * 3) + (time.Minute * 10)
......
......@@ -77,16 +77,15 @@ func TestDocument(t *testing.T) {
sharedRandomCommit := make([]byte, SharedRandomLength)
binary.BigEndian.PutUint64(sharedRandomCommit[:8], debugTestEpoch)
// Generate a Document.
doc := &Document{
Epoch: debugTestEpoch,
SendRatePerMinute: testSendRate,
Topology: make([][][]byte, 3),
MixLambda: 0.42,
MixMaxDelay: 23,
SendLambda: 0.69,
SendMaxInterval: 17,
Epoch: debugTestEpoch,
SendRatePerMinute: testSendRate,
Topology: make([][][]byte, 3),
MixLambda: 0.42,
MixMaxDelay: 23,
SendLambda: 0.69,
SendMaxInterval: 17,
SharedRandomCommit: sharedRandomCommit,
SharedRandomValue: make([]byte, SharedRandomValueLength),
}
......
......@@ -113,7 +113,7 @@ func (s *Server) IdentityKey() *eddsa.PublicKey {
func (s *Server) RotateLog() {
err := s.logBackend.Rotate()
if err != nil {
s.fatalErrCh <- fmt.Errorf("Failed to rotate log file, shutting down server.")
s.fatalErrCh <- fmt.Errorf("failed to rotate log file, shutting down server")
}
s.log.Notice("Log rotated.")
}
......
......@@ -135,7 +135,7 @@ func (s *kimchi) genGoodVotingAuthoritiesCfg(numAuthorities int) error {
Addresses: []string{fmt.Sprintf("127.0.0.1:%d", s.lastPort)},
DataDir: filepath.Join(s.baseDir, fmt.Sprintf("authority%d", i)),
}
s.lastPort += 1
s.lastPort++
privateIdentityKey, err := eddsa.NewKeypair(rand.Reader)
if err != nil {
return err
......@@ -188,7 +188,7 @@ func (s *kimchi) genBadVotingAuthoritiesCfg(numAuthorities int) error {
Addresses: []string{fmt.Sprintf("127.0.0.1:%d", s.lastPort)},
DataDir: filepath.Join(s.baseDir, fmt.Sprintf("authority%d", i)),
}
s.lastPort += 1
s.lastPort++
privateIdentityKey, err := eddsa.NewKeypair(rand.Reader)
if err != nil {
return err
......
......@@ -226,9 +226,9 @@ func (p *connector) randomPeerRoundTrip(ctx context.Context, linkKey *ecdh.Priva
// Client is a PKI client.
type Client struct {
cfg *Config
log *logging.Logger
pool *connector
cfg *Config
log *logging.Logger
pool *connector
verifiers []cert.Verifier
threshold int
}
......
......@@ -109,7 +109,7 @@ func (s *Server) IdentityKey() *eddsa.PublicKey {
func (s *Server) RotateLog() {
err := s.logBackend.Rotate()
if err != nil {
s.fatalErrCh <- fmt.Errorf("Failed to rotate log file, shutting down server.")
s.fatalErrCh <- fmt.Errorf("failed to rotate log file, shutting down server")
}
s.log.Notice("Log rotated.")
}
......
......@@ -628,10 +628,10 @@ func (s *state) tallyVotes(epoch uint64) ([]*descriptor, *config.Parameters, err
// Lock is held (called from the onWakeup hook).
_, ok := s.votes[epoch]
if !ok {
return nil, nil, fmt.Errorf("No votes for epoch %v!", epoch)
return nil, nil, fmt.Errorf("no votes for epoch %v", epoch)
}
if len(s.votes[epoch]) <= s.threshold {
return nil, nil, fmt.Errorf("Not enough votes for epoch %v!", epoch)
return nil, nil, fmt.Errorf("not enough votes for epoch %v", epoch)
}
nodes := make([]*descriptor, 0)
......@@ -735,11 +735,11 @@ func (s *state) tallyVotes(epoch uint64) ([]*descriptor, *config.Parameters, err
return nodes, params, nil
}
} else if len(votes) >= s.dissenters {
return nil, nil, errors.New("Consensus partition?!")
return nil, nil, errors.New("a consensus partition")
}
}
return nil, nil, errors.New("Consensus failure!")
return nil, nil, errors.New("consensus failure")
}
func (s *state) GetConsensus(epoch uint64) (*document, error) {
......@@ -1487,6 +1487,6 @@ func sortNodesByPublicKey(nodes []*descriptor) {
}
func sha256b64(raw []byte) string {
var hash [32]byte = sha3.Sum256(raw)
var hash = sha3.Sum256(raw)
return base64.StdEncoding.EncodeToString(hash[:])
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment