Skip to content

Commit 8b5b377

Browse files
committed
[feat] remove the function to clean the ISP
1 parent 339f388 commit 8b5b377

File tree

1 file changed

+1
-64
lines changed

1 file changed

+1
-64
lines changed

pkg/db/postgresql/ips.go

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package postgresql
22

33
import (
44
"time"
5-
"strings"
65

76
"github.com/jackc/pgx/v4"
87
"github.com/migalabs/armiarma/pkg/db/models"
@@ -11,68 +10,6 @@ import (
1110
log "github.com/sirupsen/logrus"
1211
)
1312

14-
var ispCleaner = []struct {
15-
substr, name string
16-
}{
17-
{"amazon", "Amazon"},
18-
{"google", "Google"},
19-
{"microsoft", "Microsoft"},
20-
{"oracle", "Oracle"},
21-
{"at&t", "AT&T"},
22-
{"vodafone", "Vodafone"},
23-
{"orange", "Orange"},
24-
{"china mobile", "China Mobile"},
25-
{"china telecom", "China Telecom"},
26-
{"alibaba", "Alibaba"},
27-
{"pt comunicacoes", "PT Comunicacoes"},
28-
{"swisscom", "Swisscom"},
29-
{"sony", "Sony"},
30-
{"telecom argentina", "Telecom Argentina"},
31-
{"ovh", "OVH"},
32-
{"t-mobile", "T-Mobile"},
33-
{"hetzner", "Hetzner"},
34-
{"digitalocean", "DigitalOcean"},
35-
{"verizon", "Verizon"},
36-
{"virgin media", "Virgin Media"},
37-
{"hostinger", "Hostinger"},
38-
{"telefonica", "Telefonica"},
39-
{"contabo", "Contabo"},
40-
{"mevspace", "Mevspace"},
41-
{"chinanet", "Chinanet"},
42-
{"kamatera", "Kamatera"},
43-
{"teraswitch", "TeraSwitch"},
44-
{"emirates telecommunications", "Etisalat"},
45-
{"emirates integrated telecommunications", "du"},
46-
{"centurylink", "CenturyLink"},
47-
{"huawei", "Huawei"},
48-
{"frontier communications", "Frontier Communications"},
49-
{"charter communications", "Charter Communications"},
50-
{"digi ", "DIGI"},
51-
{"akamai", "Akamai Technologies"},
52-
{"china unicom", "China Unicom"},
53-
{"telus communications", "TELUS Communications"},
54-
{"datacamp limited", "DataCamp"},
55-
{"limestone", "Limestone Networks"},
56-
{"hong kong telecommunications", "Hong Kong Telecommunications"},
57-
{"velia.net", "velia.net"},
58-
{"comcast", "Comcast"},
59-
{"init7", "Init7"},
60-
{"hivelocity", "Hivelocity"},
61-
{"leaseweb", "LeaseWeb"},
62-
{"fornex hosting", "Fornex Hosting"},
63-
{"servers.com", "Servers.com"},
64-
{"nos comunicacoes", "NOS Comunicacoes"},
65-
}
66-
67-
func CleanISP(isp string) (string) {
68-
for _, ispClean := range ispCleaner{
69-
if strings.Contains(strings.ToLower(isp), ispClean.substr){
70-
return ispClean.name
71-
}
72-
}
73-
return isp
74-
}
75-
7613
func (c *DBClient) InitIpTable() error {
7714
log.Debug("init ips table in psql-db")
7815
_, err := c.psqlPool.Exec(c.ctx, `
@@ -167,7 +104,7 @@ func (c *DBClient) UpsertIpInfo(ipInfo models.IpInfo) (query string, args []inte
167104
args = append(args, ipInfo.Zip)
168105
args = append(args, ipInfo.Lat)
169106
args = append(args, ipInfo.Lon)
170-
args = append(args, CleanISP(ipInfo.Isp))
107+
args = append(args, ipInfo.Isp)
171108
args = append(args, ipInfo.Org)
172109
args = append(args, ipInfo.As)
173110
args = append(args, ipInfo.AsName)

0 commit comments

Comments
 (0)