mirror of
https://github.com/yggdrasil-network/water.git
synced 2025-05-19 08:25:09 +03:00
Fix to use To4()
This will also produce a runtime error if non-IPv4 addresses are passed in.
This commit is contained in:
parent
735b3a96b7
commit
93f6384fdd
1 changed files with 2 additions and 2 deletions
|
@ -29,7 +29,7 @@ func IPv4Source(packet []byte) net.IP {
|
|||
}
|
||||
|
||||
func SetIPv4Source(packet []byte, source net.IP) {
|
||||
copy(packet[12:16], source)
|
||||
copy(packet[12:16], source.To4())
|
||||
}
|
||||
|
||||
func IPv4Destination(packet []byte) net.IP {
|
||||
|
@ -37,7 +37,7 @@ func IPv4Destination(packet []byte) net.IP {
|
|||
}
|
||||
|
||||
func SetIPv4Destination(packet []byte, dest net.IP) {
|
||||
copy(packet[16:20], dest)
|
||||
copy(packet[16:20], dest.To4())
|
||||
}
|
||||
|
||||
func IPv4Payload(packet []byte) []byte {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue