added ipv6 compatability to other commands

This commit is contained in:
2021-06-25 17:22:01 +04:00
parent 21b9efc3a6
commit 657577f583
5 changed files with 81 additions and 136 deletions

View File

@@ -43,7 +43,12 @@ func Server() error{
r.POST("/IpTable", func(c *gin.Context) {
// Getting IPV4 address of client
var ClientHost p2p.IpAddress
ClientHost.Ipv4 = c.ClientIP()
if p2p.Ip4or6(c.ClientIP()) == "version 6" {
ClientHost.Ipv6 = c.ClientIP()
} else {
ClientHost.Ipv4 = c.ClientIP()
}
// Variable to store IP table information
var IPTable p2p.IpAddresses
@@ -77,12 +82,6 @@ func Server() error{
c.String(http.StatusOK, fmt.Sprint(err))
}
// Called step to remove duplicate IP addresses
err = p2p.RemoveDuplicates()
if err != nil {
c.String(http.StatusOK, fmt.Sprint(err))
}
// Reads IP addresses from ip table
IpAddresses,err := p2p.ReadIpTable()
if err != nil {