mirror of
https://github.com/net-byte/vtun
synced 2024-03-14 10:50:03 +08:00
fix
This commit is contained in:
parent
fd7e3f9cf7
commit
4cc118f40d
@ -47,7 +47,7 @@ func GetAddr(b []byte) (srcAddr string, dstAddr string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetPort(b []byte) (srcPort string, dstPort string) {
|
func GetPort(b []byte) (srcPort string, dstPort string) {
|
||||||
packet := gopacket.NewPacket(b, layers.LayerTypeEthernet, gopacket.Default)
|
packet := gopacket.NewPacket(b, layers.LayerTypeIPv4, gopacket.Default)
|
||||||
if tcpLayer := packet.Layer(layers.LayerTypeTCP); tcpLayer != nil {
|
if tcpLayer := packet.Layer(layers.LayerTypeTCP); tcpLayer != nil {
|
||||||
tcp, _ := tcpLayer.(*layers.TCP)
|
tcp, _ := tcpLayer.(*layers.TCP)
|
||||||
return tcp.SrcPort.String(), tcp.DstPort.String()
|
return tcp.SrcPort.String(), tcp.DstPort.String()
|
||||||
|
Loading…
Reference in New Issue
Block a user