github.com/database64128/shadowsocks-go@v1.10.2-0.20240315062903-143a773533f1/conn/conn_freebsd.go (about) 1 package conn 2 3 import ( 4 "fmt" 5 6 "golang.org/x/sys/unix" 7 ) 8 9 func setFwmark(fd, fwmark int) error { 10 if err := unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_USER_COOKIE, fwmark); err != nil { 11 return fmt.Errorf("failed to set socket option SO_MARK: %w", err) 12 } 13 return nil 14 } 15 16 func (lso ListenerSocketOptions) buildSetFns() setFuncSlice { 17 return setFuncSlice{}. 18 appendSetFwmarkFunc(lso.Fwmark). 19 appendSetTrafficClassFunc(lso.TrafficClass). 20 appendSetReusePortFunc(lso.ReusePort). 21 appendSetPMTUDFunc(lso.PathMTUDiscovery) 22 }