github.com/database64128/shadowsocks-go@v1.10.2-0.20240315062903-143a773533f1/conn/conn_freebsdlinux.go (about)

     1  //go:build freebsd || linux
     2  
     3  package conn
     4  
     5  func (fns setFuncSlice) appendSetFwmarkFunc(fwmark int) setFuncSlice {
     6  	if fwmark != 0 {
     7  		return append(fns, func(fd int, network string) error {
     8  			return setFwmark(fd, fwmark)
     9  		})
    10  	}
    11  	return fns
    12  }
    13  
    14  func (dso DialerSocketOptions) buildSetFns() setFuncSlice {
    15  	return setFuncSlice{}.
    16  		appendSetFwmarkFunc(dso.Fwmark).
    17  		appendSetTrafficClassFunc(dso.TrafficClass)
    18  }