Source File
sockopt_posix.go
Belonging Package
net
// Copyright 2009 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build unix || windowspackage netimport ()// Boolean to int.func ( bool) int {if {return 1}return 0}func ( *Interface) (IP, error) {if == nil {return IPv4zero, nil}, := .Addrs()if != nil {return nil,}for , := range {switch v := .(type) {case *IPAddr:if .IP.To4() != nil {return .IP, nil}case *IPNet:if .IP.To4() != nil {return .IP, nil}}}return nil, errNoSuchInterface}func ( *syscall.IPMreq, *Interface) error {if == nil {return nil}, := .Addrs()if != nil {return}for , := range {switch v := .(type) {case *IPAddr:if := .IP.To4(); != nil {copy(.Interface[:], )goto}case *IPNet:if := .IP.To4(); != nil {copy(.Interface[:], )goto}}}:if bytealg.Equal(.Multiaddr[:], IPv4zero.To4()) {return errNoSuchMulticastInterface}return nil}func ( *netFD, int) error {:= .pfd.SetsockoptInt(syscall.SOL_SOCKET, syscall.SO_RCVBUF, )runtime.KeepAlive()return wrapSyscallError("setsockopt", )}func ( *netFD, int) error {:= .pfd.SetsockoptInt(syscall.SOL_SOCKET, syscall.SO_SNDBUF, )runtime.KeepAlive()return wrapSyscallError("setsockopt", )}func ( *netFD, bool) error {:= .pfd.SetsockoptInt(syscall.SOL_SOCKET, syscall.SO_KEEPALIVE, boolint())runtime.KeepAlive()return wrapSyscallError("setsockopt", )}func ( *netFD, int) error {var syscall.Lingerif >= 0 {.Onoff = 1.Linger = int32()} else {.Onoff = 0.Linger = 0}:= .pfd.SetsockoptLinger(syscall.SOL_SOCKET, syscall.SO_LINGER, &)runtime.KeepAlive()return wrapSyscallError("setsockopt", )}
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)