Skip to content

Commit cf2290d

Browse files
author
Aaron Meihm
committed
fix linter warnings
1 parent 2c97365 commit cf2290d

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

exception.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
var activeTree *iptree.IPTree
1818
var treeLock sync.Mutex
19-
var isExceptionUpdate bool = false
19+
var isExceptionUpdate = false
2020

2121
type awsIPRanges struct {
2222
Prefixes []struct {

http.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ func newRouter() *mux.Router {
9898
// To maintain compatibility with previous API versions, wrap legacy API
9999
// calls to add the type field and route to the correct handler
100100
r.HandleFunc("/{value:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}}",
101-
auth(wrapLegacyIpRequest(httpGetReputation))).Methods("GET")
101+
auth(wrapLegacyIPRequest(httpGetReputation))).Methods("GET")
102102
r.HandleFunc("/{value:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}}",
103-
auth(wrapLegacyIpRequest(httpPutReputation))).Methods("PUT")
103+
auth(wrapLegacyIPRequest(httpPutReputation))).Methods("PUT")
104104
r.HandleFunc("/{value:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}}",
105-
auth(wrapLegacyIpRequest(httpDeleteReputation))).Methods("DELETE")
105+
auth(wrapLegacyIPRequest(httpDeleteReputation))).Methods("DELETE")
106106
r.HandleFunc("/violations/{value:(?:[0-9]{1,3}\\.){3}[0-9]{1,3}}",
107-
auth(wrapLegacyIpRequest(httpPutViolation))).Methods("PUT")
108-
r.HandleFunc("/violations", auth(wrapLegacyIpRequest(httpPutViolations))).Methods("PUT")
107+
auth(wrapLegacyIPRequest(httpPutViolation))).Methods("PUT")
108+
r.HandleFunc("/violations", auth(wrapLegacyIPRequest(httpPutViolations))).Methods("PUT")
109109

110110
r.HandleFunc("/violations", auth(httpGetViolations)).Methods("GET")
111111
r.HandleFunc("/dump", auth(httpGetAllReputation)).Methods("GET")
@@ -122,7 +122,7 @@ func startAPI() error {
122122
return http.ListenAndServe(sruntime.cfg.Listen, mwHandler(newRouter()))
123123
}
124124

125-
func wrapLegacyIpRequest(rf func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {
125+
func wrapLegacyIPRequest(rf func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {
126126
return func(w http.ResponseWriter, r *http.Request) {
127127
m := mux.Vars(r)
128128
m["type"] = "ip"

http_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,25 +198,25 @@ func TestHandlers(t *testing.T) {
198198
c := 0
199199
for _, rep := range reputations {
200200
if rep.Object == "192.168.2.20" {
201-
c += 1
201+
c++
202202
assert.Equal(t, "192.168.2.20", rep.Object)
203203
assert.Equal(t, "ip", rep.Type)
204204
assert.Equal(t, 25, rep.Reputation)
205205
}
206206
if rep.Object == "192.168.0.1" {
207-
c += 1
207+
c++
208208
assert.Equal(t, "192.168.0.1", rep.Object)
209209
assert.Equal(t, "ip", rep.Type)
210210
assert.Equal(t, 50, rep.Reputation)
211211
}
212212
if rep.Object == "[email protected]" {
213-
c += 1
213+
c++
214214
assert.Equal(t, "[email protected]", rep.Object)
215215
assert.Equal(t, "email", rep.Type)
216216
assert.Equal(t, 50, rep.Reputation)
217217
}
218218
if rep.IP == "254.254.254.254" {
219-
c += 1
219+
c++
220220
assert.Equal(t, "254.254.254.254", rep.IP)
221221
assert.Equal(t, "", rep.Object)
222222
assert.Equal(t, "", rep.Type)

validators.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
)
88

99
var validators = map[string]func(string) error{
10-
"ip": validateTypeIp,
10+
"ip": validateTypeIP,
1111
"email": validateTypeEmail,
1212
}
1313

14-
func validateTypeIp(val string) error {
14+
func validateTypeIP(val string) error {
1515
if net.ParseIP(val) == nil {
1616
return fmt.Errorf("invalid ip format %v", val)
1717
}

0 commit comments

Comments
 (0)