github.com/ipfans/trojan-go@v0.11.0/tunnel/tproxy/getsockopt.go (about)

     1  //go:build linux && !386
     2  // +build linux,!386
     3  
     4  package tproxy
     5  
     6  import (
     7  	"syscall"
     8  	"unsafe"
     9  )
    10  
    11  func getsockopt(fd int, level int, optname int, optval unsafe.Pointer, optlen *uint32) (err error) {
    12  	_, _, e := syscall.Syscall6(
    13  		syscall.SYS_GETSOCKOPT, uintptr(fd), uintptr(level), uintptr(optname),
    14  		uintptr(optval), uintptr(unsafe.Pointer(optlen)), 0)
    15  	if e != 0 {
    16  		return e
    17  	}
    18  	return
    19  }