type Ifreq … // NewIfreq creates an Ifreq with the input network interface name after // validating the name does not exceed IFNAMSIZ-1 (trailing NULL required) // bytes. func NewIfreq(name string) (*Ifreq, error) { … } // Name returns the interface name associated with the Ifreq. func (ifr *Ifreq) Name() string { … } // Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C // in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not // AF_INET, an error is returned. func (ifr *Ifreq) Inet4Addr() ([]byte, error) { … } // SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an // embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length // or an error will be returned. func (ifr *Ifreq) SetInet4Addr(v []byte) error { … } // Uint16 returns the Ifreq union data as a C short/Go uint16 value. func (ifr *Ifreq) Uint16() uint16 { … } // SetUint16 sets a C short/Go uint16 value as the Ifreq's union data. func (ifr *Ifreq) SetUint16(v uint16) { … } // Uint32 returns the Ifreq union data as a C int/Go uint32 value. func (ifr *Ifreq) Uint32() uint32 { … } // SetUint32 sets a C int/Go uint32 value as the Ifreq's union data. func (ifr *Ifreq) SetUint32(v uint32) { … } // clear zeroes the ifreq's union field to prevent trailing garbage data from // being sent to the kernel if an ifreq is reused. func (ifr *Ifreq) clear() { … } type ifreqData … // withData produces an ifreqData with the pointer p set for ioctls which require // arbitrary pointer data. func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData { … }