Skip to content
Snippets Groups Projects
Commit 8bbdb3b5 authored by Shane Howearth's avatar Shane Howearth Committed by Cecylia Bocovich
Browse files

Bring code into line with Golangci-lint linters

- Error strings are no longer capitalized nor end with punctuation
- Alias import
- Remove extraneous initilisation code (No need to provide zero value
	for variables, because the compiler does that anyway)
parent b26c7a7a
No related branches found
No related tags found
No related merge requests found
......@@ -44,13 +44,13 @@ func (p *Peers) Collect() (Snowflake, error) {
cnt := p.Count()
s := fmt.Sprintf("Currently at [%d/%d]", cnt, p.capacity)
if cnt >= p.capacity {
s := fmt.Sprintf("At capacity [%d/%d]", cnt, p.capacity)
s = fmt.Sprintf("At capacity [%d/%d]", cnt, p.capacity)
return nil, errors.New(s)
}
log.Println("WebRTC: Collecting a new Snowflake.", s)
// Engage the Snowflake Catching interface, which must be available.
if nil == p.Tongue {
return nil, errors.New("Missing Tongue to catch Snowflakes with.")
return nil, errors.New("missing Tongue to catch Snowflakes with")
}
// BUG: some broker conflict here.
connection, err := p.Tongue.Catch()
......
......@@ -144,7 +144,7 @@ func NewWebRTCDialer(
// Initialize a WebRTC Connection by signaling through the broker.
func (w WebRTCDialer) Catch() (Snowflake, error) {
if nil == w.BrokerChannel {
return nil, errors.New("Cannot Dial WebRTC without a BrokerChannel.")
return nil, errors.New("cannot Dial WebRTC without a BrokerChannel")
}
// TODO: [#3] Fetch ICE server information from Broker.
// TODO: [#18] Consider TURN servers here too.
......
......@@ -309,7 +309,7 @@ func (c *WebRTCPeer) exchangeSDP() error {
}
// Keep trying the same offer until a valid answer arrives.
var ok bool
var answer *webrtc.SessionDescription = nil
var answer *webrtc.SessionDescription
for nil == answer {
go c.sendOfferToBroker()
answer, ok = <-c.answerChannel // Blocks...
......
......@@ -14,7 +14,7 @@ import (
"syscall"
"time"
"git.torproject.org/pluggable-transports/goptlib.git"
pt "git.torproject.org/pluggable-transports/goptlib.git"
sf "git.torproject.org/pluggable-transports/snowflake.git/client/lib"
"git.torproject.org/pluggable-transports/snowflake.git/common/safelog"
"github.com/pion/webrtc"
......@@ -102,7 +102,7 @@ func main() {
// deadlock because the buffer is full.
// https://bugs.torproject.org/26360
// https://bugs.torproject.org/25600#comment:14
var logOutput io.Writer = ioutil.Discard
var logOutput = ioutil.Discard
if *logFilename != "" {
if *logToStateDir {
stateDir, err := pt.MakeStateDir()
......@@ -184,7 +184,7 @@ func main() {
}
pt.CmethodsDone()
var numHandlers int = 0
var numHandlers int
var sig os.Signal
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGTERM)
......
......@@ -19,7 +19,7 @@ import (
"syscall"
"time"
"git.torproject.org/pluggable-transports/goptlib.git"
pt "git.torproject.org/pluggable-transports/goptlib.git"
"git.torproject.org/pluggable-transports/snowflake.git/common/safelog"
"git.torproject.org/pluggable-transports/websocket.git/websocket"
"golang.org/x/crypto/acme/autocert"
......@@ -390,7 +390,7 @@ func main() {
}
pt.SmethodsDone()
var numHandlers int = 0
var numHandlers int
var sig os.Signal
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGTERM)
......
......@@ -27,9 +27,9 @@ func statsThread() {
select {
case v := <-statsChannel:
if v {
numClientIP += 1
numClientIP++
}
numConnections += 1
numConnections++
case <-deadline:
now := time.Now()
log.Printf("in the past %.f s, %d/%d connections had client_ip",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment