KatelynHaworth / go-tproxy

Linux Transparent Proxy library for Golang
MIT License
305 stars 59 forks source link

Native Endian rather than BigEndian #9

Open leocrawford opened 3 years ago

leocrawford commented 3 years ago

In tproxy_udp.go we have:

if err = binary.Read(bytes.NewReader(msg.Data), binary.BigEndian, originalDstRaw); err != nil {

This failed on a big endian box, but adjusting it to

if err = binary.Read(bytes.NewReader(msg.Data), nativeEndian, originalDstRaw); err != nil {

where nativeEndian was defined here: https://stackoverflow.com/questions/51332658/any-better-way-to-check-endianness-in-go worked fine.