93 lines
2.1 KiB
Go
93 lines
2.1 KiB
Go
package converter
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestMacToInt(t *testing.T) {
|
|
|
|
}
|
|
|
|
func TestIntToMac(t *testing.T) {
|
|
tt := IntToMac(75361038758387)
|
|
|
|
//seelog.Debug(tt.String())
|
|
fmt.Println(tt.String())
|
|
}
|
|
|
|
func TestIntToIP4(t *testing.T) {
|
|
|
|
tt := IntToIP4(3232235877)
|
|
fmt.Println(tt.String())
|
|
}
|
|
|
|
func TestIpMac(t *testing.T) {
|
|
ipMacMap := map[int64]int64{
|
|
3232235777: 119779280707688,
|
|
3232235787: 159013445376676,
|
|
3232235977: 75361038758611,
|
|
3232235782: 91754660618,
|
|
3232235796: 91754662917,
|
|
3232235820: 91754662924,
|
|
3232235786: 159013445376672,
|
|
3232235798: 91754662914,
|
|
3232235842: 126665265695,
|
|
3232235800: 91754662916,
|
|
3232235879: 75361027394792,
|
|
3232235983: 8796753988883,
|
|
3232236030: 110937283749760,
|
|
3232235984: 237872197994881,
|
|
3232235978: 92378945339098,
|
|
3232235778: 269295397419301,
|
|
3232235881: 88945707094824,
|
|
3232235797: 91754662913,
|
|
3232235882: 75361038711421,
|
|
3232235864: 207120303401094,
|
|
3232235806: 91754662922,
|
|
3232235880: 92378945273005,
|
|
3232235788: 159013445322194,
|
|
3232235865: 207120303401094,
|
|
3232235877: 75361038758387,
|
|
}
|
|
|
|
//ipMacMap := map[int64]int64{
|
|
// 3232235787: 159013445376676,
|
|
// 3232235782: 91754660618,
|
|
// 3232235798: 91754662914,
|
|
// 3232235842: 126665265695,
|
|
// 3232235879: 75361027394792,
|
|
// 3232236030: 110937283749760,
|
|
// 3232235978: 92378945339098,
|
|
// 3232235877: 75361038758387,
|
|
// 3232235820: 91754662924,
|
|
// 3232235864: 207120303401094,
|
|
// 3232235881: 88945707094824,
|
|
// 3232235977: 75361038758611,
|
|
// 3232235806: 91754662922,
|
|
// 3232235777: 119779280707688,
|
|
// 3232235983: 8796753988883,
|
|
// 3232235796: 91754662917,
|
|
// 3232235778: 269295397419301,
|
|
// 3232235788: 159013445322194,
|
|
// 3232235786: 159013445376672,
|
|
// 3232235882: 75361038711421,
|
|
// 3232235800: 91754662916,
|
|
// 3232235880: 92378945273005,
|
|
// 3232235865: 207120303401094,
|
|
// 3232235797: 91754662913,
|
|
//}
|
|
|
|
for k, v := range ipMacMap {
|
|
ip := IntToIP4(k)
|
|
mac := IntToMac(v)
|
|
|
|
if strings.Compare("192.168.1.208", ip.String()) == 0 {
|
|
fmt.Println(k)
|
|
fmt.Println(v)
|
|
}
|
|
fmt.Println("IP: ", ip.String(), "\t Mac : ", mac.String())
|
|
}
|
|
}
|