Skip to content

Commit 3d9fb49

Browse files
committed
Remove unused enum
1 parent 9cbe1cc commit 3d9fb49

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func main() {
9191
if *ip2proxyLiteFlag {
9292
goroutinesCount++
9393
o := ip2proxy{
94-
Type: IP2PROXY_LITE,
94+
Name: "ip2proxyLite",
9595
Token: *ip2proxyLiteToken,
9696
Filename: *ip2proxyLiteFilename,
9797
ErrorsChan: errorChannel,
@@ -104,7 +104,7 @@ func main() {
104104
if *ip2proxyFlag {
105105
goroutinesCount++
106106
o := ip2proxy{
107-
Type: IP2PROXY_PRO,
107+
Name: "ip2proxyPro",
108108
Token: *ip2proxyToken,
109109
Filename: *ip2proxyFilename,
110110
ErrorsChan: errorChannel,

ip2proxy.go

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ import (
1212
"strconv"
1313
)
1414

15-
const (
16-
IP2PROXY_PRO = iota
17-
IP2PROXY_LITE
18-
)
19-
2015
type ip2proxyItem struct {
2116
IPFrom net.IP
2217
IPTo net.IP
@@ -29,39 +24,36 @@ type ip2proxyItem struct {
2924
}
3025

3126
type ip2proxy struct {
32-
Type int
3327
items []*ip2proxyItem
3428
archive []*zip.File
3529
OutputDir string
3630
ErrorsChan chan Error
3731
Token string
3832
Filename string
39-
name string
33+
Name string
4034
csvFilename string
4135
zipFilename string
4236
PrintType bool
4337
}
4438

4539
func (o *ip2proxy) checkErr(err error, message string) bool {
4640
if err != nil {
47-
o.ErrorsChan <- Error{err, o.name, message}
41+
o.ErrorsChan <- Error{err, o.Name, message}
4842
return true
4943
}
50-
printMessage(o.name, message, "OK")
44+
printMessage(o.Name, message, "OK")
5145
return false
5246
}
5347

5448
func (o *ip2proxy) Get() {
55-
if o.Type == IP2PROXY_PRO {
56-
o.name = "ip2proxyPro"
49+
if o.Name == "ip2proxyPro" {
5750
o.csvFilename = "IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.CSV"
5851
o.zipFilename = "PX4-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP"
59-
} else if o.Type == IP2PROXY_LITE {
60-
o.name = "ip2proxyLite"
52+
} else if o.Name == "ip2proxyLite" {
6153
o.csvFilename = "IP2PROXY-LITE-PX4.CSV"
6254
o.zipFilename = "PX4LITE"
6355
} else {
64-
o.ErrorsChan <- Error{errors.New("Unknown ip2proxy type requested"), o.name, "bad init"}
56+
o.ErrorsChan <- Error{errors.New("Unknown ip2proxy type requested"), o.Name, "bad init"}
6557
return
6658
}
6759
fileData, err := o.getZip()
@@ -125,10 +117,10 @@ func (o *ip2proxy) unpack(response []byte) error {
125117

126118
func (o *ip2proxy) Parse(filename string) error {
127119
var list []*ip2proxyItem
128-
for record := range readCSVDatabase(o.archive, filename, o.name, ',', false) {
120+
for record := range readCSVDatabase(o.archive, filename, o.Name, ',', false) {
129121
item, err := o.lineToItem(record)
130122
if err != nil {
131-
printMessage(o.name, fmt.Sprintf("Can't parse line from %s with %v", filename, err), "WARN")
123+
printMessage(o.Name, fmt.Sprintf("Can't parse line from %s with %v", filename, err), "WARN")
132124
continue
133125
}
134126
list = append(list, item)
@@ -168,7 +160,7 @@ func (o *ip2proxy) Write() error {
168160
}
169161

170162
func (o *ip2proxy) writeNetworks() error {
171-
file, err := os.Create(path.Join(o.OutputDir, o.name+"_net.txt"))
163+
file, err := os.Create(path.Join(o.OutputDir, o.Name+"_net.txt"))
172164
if err != nil {
173165
return err
174166
}

0 commit comments

Comments
 (0)