winipcfg

package
v0.0.0-...-0e93635 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: GPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IfTypeOther                         IfType = 1 // None of the below
	IfTypeRegular1822                          = 2
	IfTypeHdh1822                              = 3
	IfTypeDdnX25                               = 4
	IfTypeRfc877X25                            = 5
	IfTypeEthernetCSMACD                       = 6
	IfTypeISO88023CSMACD                       = 7
	IfTypeISO88024Tokenbus                     = 8
	IfTypeISO88025Tokenring                    = 9
	IfTypeISO88026Man                          = 10
	IfTypeStarlan                              = 11
	IfTypeProteon10Mbit                        = 12
	IfTypeProteon80Mbit                        = 13
	IfTypeHyperchannel                         = 14
	IfTypeFddi                                 = 15
	IfTypeLapB                                 = 16
	IfTypeSdlc                                 = 17
	IfTypeDs1                                  = 18 // DS1-MIB
	IfTypeE1                                   = 19 // Obsolete; see DS1-MIB
	IfTypeBasicISDN                            = 20
	IfTypePrimaryISDN                          = 21
	IfTypePropPoint2PointSerial                = 22 // proprietary serial
	IfTypePPP                                  = 23
	IfTypeSoftwareLoopback                     = 24
	IfTypeEon                                  = 25 // CLNP over IP
	IfTypeEthernet3Mbit                        = 26
	IfTypeNsip                                 = 27 // XNS over IP
	IfTypeSlip                                 = 28 // Generic Slip
	IfTypeUltra                                = 29 // ULTRA Technologies
	IfTypeDs3                                  = 30 // DS3-MIB
	IfTypeSip                                  = 31 // SMDS, coffee
	IfTypeFramerelay                           = 32 // DTE only
	IfTypeRs232                                = 33
	IfTypePara                                 = 34 // Parallel port
	IfTypeArcnet                               = 35
	IfTypeArcnetPlus                           = 36
	IfTypeAtm                                  = 37 // ATM cells
	IfTypeMioX25                               = 38
	IfTypeSonet                                = 39 // SONET or SDH
	IfTypeX25Ple                               = 40
	IfTypeIso88022LLC                          = 41
	IfTypeLocaltalk                            = 42
	IfTypeSmdsDxi                              = 43
	IfTypeFramerelayService                    = 44 // FRNETSERV-MIB
	IfTypeV35                                  = 45
	IfTypeHssi                                 = 46
	IfTypeHippi                                = 47
	IfTypeModem                                = 48 // Generic Modem
	IfTypeAal5                                 = 49 // AAL5 over ATM
	IfTypeSonetPath                            = 50
	IfTypeSonetVt                              = 51
	IfTypeSmdsIcip                             = 52 // SMDS InterCarrier Interface
	IfTypePropVirtual                          = 53 // Proprietary virtual/internal
	IfTypePropMultiplexor                      = 54 // Proprietary multiplexing
	IfTypeIEEE80212                            = 55 // 100BaseVG
	IfTypeFibrechannel                         = 56
	IfTypeHippiinterface                       = 57
	IfTypeFramerelayInterconnect               = 58 // Obsolete, use 32 or 44
	IfTypeAflane8023                           = 59 // ATM Emulated LAN for 802.3
	IfTypeAflane8025                           = 60 // ATM Emulated LAN for 802.5
	IfTypeCctemul                              = 61 // ATM Emulated circuit
	IfTypeFastether                            = 62 // Fast Ethernet (100BaseT)
	IfTypeISDN                                 = 63 // ISDN and X.25
	IfTypeV11                                  = 64 // CCITT V.11/X.21
	IfTypeV36                                  = 65 // CCITT V.36
	IfTypeG703_64k                             = 66 // CCITT G703 at 64Kbps
	IfTypeG703_2mb                             = 67 // Obsolete; see DS1-MIB
	IfTypeQllc                                 = 68 // SNA QLLC
	IfTypeFastetherFX                          = 69 // Fast Ethernet (100BaseFX)
	IfTypeChannel                              = 70
	IfTypeIEEE80211                            = 71  // Radio spread spectrum
	IfTypeIBM370parchan                        = 72  // IBM System 360/370 OEMI Channel
	IfTypeEscon                                = 73  // IBM Enterprise Systems Connection
	IfTypeDlsw                                 = 74  // Data Link Switching
	IfTypeISDNS                                = 75  // ISDN S/T interface
	IfTypeISDNU                                = 76  // ISDN U interface
	IfTypeLapD                                 = 77  // Link Access Protocol D
	IfTypeIpswitch                             = 78  // IP Switching Objects
	IfTypeRsrb                                 = 79  // Remote Source Route Bridging
	IfTypeAtmLogical                           = 80  // ATM Logical Port
	IfTypeDs0                                  = 81  // Digital Signal Level 0
	IfTypeDs0Bundle                            = 82  // Group of ds0s on the same ds1
	IfTypeBsc                                  = 83  // Bisynchronous Protocol
	IfTypeAsync                                = 84  // Asynchronous Protocol
	IfTypeCnr                                  = 85  // Combat Net Radio
	IfTypeIso88025rDtr                         = 86  // ISO 802.5r DTR
	IfTypeEplrs                                = 87  // Ext Pos Loc Report Sys
	IfTypeArap                                 = 88  // Appletalk Remote Access Protocol
	IfTypePropCnls                             = 89  // Proprietary Connectionless Proto
	IfTypeHostpad                              = 90  // CCITT-ITU X.29 PAD Protocol
	IfTypeTermpad                              = 91  // CCITT-ITU X.3 PAD Facility
	IfTypeFramerelayMpi                        = 92  // Multiproto Interconnect over FR
	IfTypeX213                                 = 93  // CCITT-ITU X213
	IfTypeAdsl                                 = 94  // Asymmetric Digital Subscrbr Loop
	IfTypeRadsl                                = 95  // Rate-Adapt Digital Subscrbr Loop
	IfTypeSdsl                                 = 96  // Symmetric Digital Subscriber Loop
	IfTypeVdsl                                 = 97  // Very H-Speed Digital Subscrb Loop
	IfTypeIso88025Crfprint                     = 98  // ISO 802.5 CRFP
	IfTypeMyrinet                              = 99  // Myricom Myrinet
	IfTypeVoiceEm                              = 100 // Voice recEive and transMit
	IfTypeVoiceFxo                             = 101 // Voice Foreign Exchange Office
	IfTypeVoiceFxs                             = 102 // Voice Foreign Exchange Station
	IfTypeVoiceEncap                           = 103 // Voice encapsulation
	IfTypeVoiceOverip                          = 104 // Voice over IP encapsulation
	IfTypeAtmDxi                               = 105 // ATM DXI
	IfTypeAtmFuni                              = 106 // ATM FUNI
	IfTypeAtmIma                               = 107 // ATM IMA
	IfTypePPPmultilinkbundle                   = 108 // PPP Multilink Bundle
	IfTypeIpoverCdlc                           = 109 // IBM ipOverCdlc
	IfTypeIpoverClaw                           = 110 // IBM Common Link Access to Workstn
	IfTypeStacktostack                         = 111 // IBM stackToStack
	IfTypeVirtualipaddress                     = 112 // IBM VIPA
	IfTypeMpc                                  = 113 // IBM multi-proto channel support
	IfTypeIpoverAtm                            = 114 // IBM ipOverAtm
	IfTypeIso88025Fiber                        = 115 // ISO 802.5j Fiber Token Ring
	IfTypeTdlc                                 = 116 // IBM twinaxial data link control
	IfTypeGigabitethernet                      = 117
	IfTypeHdlc                                 = 118
	IfTypeLapF                                 = 119
	IfTypeV37                                  = 120
	IfTypeX25Mlp                               = 121 // Multi-Link Protocol
	IfTypeX25Huntgroup                         = 122 // X.25 Hunt Group
	IfTypeTransphdlc                           = 123
	IfTypeInterleave                           = 124 // Interleave channel
	IfTypeFast                                 = 125 // Fast channel
	IfTypeIP                                   = 126 // IP (for APPN HPR in IP networks)
	IfTypeDocscableMaclayer                    = 127 // CATV Mac Layer
	IfTypeDocscableDownstream                  = 128 // CATV Downstream interface
	IfTypeDocscableUpstream                    = 129 // CATV Upstream interface
	IfTypeA12mppswitch                         = 130 // Avalon Parallel Processor
	IfTypeTunnel                               = 131 // Encapsulation interface
	IfTypeCoffee                               = 132 // Coffee pot
	IfTypeCes                                  = 133 // Circuit Emulation Service
	IfTypeAtmSubinterface                      = 134 // ATM Sub Interface
	IfTypeL2Vlan                               = 135 // Layer 2 Virtual LAN using 802.1Q
	IfTypeL3Ipvlan                             = 136 // Layer 3 Virtual LAN using IP
	IfTypeL3Ipxvlan                            = 137 // Layer 3 Virtual LAN using IPX
	IfTypeDigitalpowerline                     = 138 // IP over Power Lines
	IfTypeMediamailoverip                      = 139 // Multimedia Mail over IP
	IfTypeDtm                                  = 140 // Dynamic syncronous Transfer Mode
	IfTypeDcn                                  = 141 // Data Communications Network
	IfTypeIpforward                            = 142 // IP Forwarding Interface
	IfTypeMsdsl                                = 143 // Multi-rate Symmetric DSL
	IfTypeIEEE1394                             = 144 // IEEE1394 High Perf Serial Bus
	IfTypeIfGsn                                = 145
	IfTypeDvbrccMaclayer                       = 146
	IfTypeDvbrccDownstream                     = 147
	IfTypeDvbrccUpstream                       = 148
	IfTypeAtmVirtual                           = 149
	IfTypeMplsTunnel                           = 150
	IfTypeSrp                                  = 151
	IfTypeVoiceoveratm                         = 152
	IfTypeVoiceoverframerelay                  = 153
	IfTypeIdsl                                 = 154
	IfTypeCompositelink                        = 155
	IfTypeSs7Siglink                           = 156
	IfTypePropWirelessP2P                      = 157
	IfTypeFrForward                            = 158
	IfTypeRfc1483                              = 159
	IfTypeUsb                                  = 160
	IfTypeIEEE8023adLag                        = 161
	IfTypeBgpPolicyAccounting                  = 162
	IfTypeFrf16MfrBundle                       = 163
	IfTypeH323Gatekeeper                       = 164
	IfTypeH323Proxy                            = 165
	IfTypeMpls                                 = 166
	IfTypeMfSiglink                            = 167
	IfTypeHdsl2                                = 168
	IfTypeShdsl                                = 169
	IfTypeDs1Fdl                               = 170
	IfTypePos                                  = 171
	IfTypeDvbAsiIn                             = 172
	IfTypeDvbAsiOut                            = 173
	IfTypePlc                                  = 174
	IfTypeNfas                                 = 175
	IfTypeTr008                                = 176
	IfTypeGr303Rdt                             = 177
	IfTypeGr303Idt                             = 178
	IfTypeIsup                                 = 179
	IfTypePropDocsWirelessMaclayer             = 180
	IfTypePropDocsWirelessDownstream           = 181
	IfTypePropDocsWirelessUpstream             = 182
	IfTypeHiperlan2                            = 183
	IfTypePropBwaP2MP                          = 184
	IfTypeSonetOverheadChannel                 = 185
	IfTypeDigitalWrapperOverheadChannel        = 186
	IfTypeAal2                                 = 187
	IfTypeRadioMac                             = 188
	IfTypeAtmRadio                             = 189
	IfTypeImt                                  = 190
	IfTypeMvl                                  = 191
	IfTypeReachDsl                             = 192
	IfTypeFrDlciEndpt                          = 193
	IfTypeAtmVciEndpt                          = 194
	IfTypeOpticalChannel                       = 195
	IfTypeOpticalTransport                     = 196
	IfTypeIEEE80216Wman                        = 237
	IfTypeWwanpp                               = 243 // WWAN devices based on GSM technology
	IfTypeWwanpp2                              = 244 // WWAN devices based on CDMA technology
	IfTypeIEEE802154                           = 259 // IEEE 802.15.4 WPAN interface
	IfTypeXboxWireless                         = 281
)
View Source
const (
	TunnelTypeNone    TunnelType = 0
	TunnelTypeOther              = 1
	TunnelTypeDirect             = 2
	TunnelType6to4               = 11
	TunnelTypeIsatap             = 13
	TunnelTypeTeredo             = 14
	TunnelTypeIPHTTPS            = 15
)
View Source
const (
	ScopeLevelInterface    ScopeLevel = 1
	ScopeLevelLink                    = 2
	ScopeLevelSubnet                  = 3
	ScopeLevelAdmin                   = 4
	ScopeLevelSite                    = 5
	ScopeLevelOrganization            = 8
	ScopeLevelGlobal                  = 14
	ScopeLevelCount                   = 16
)
View Source
const (
	DnsInterfaceSettingsVersion1 = 1 // for DnsInterfaceSettings
	DnsInterfaceSettingsVersion2 = 2 // for DnsInterfaceSettingsEx
	DnsInterfaceSettingsVersion3 = 3 // for DnsInterfaceSettings3

	DnsInterfaceSettingsFlagIPv6                        = 0x0001
	DnsInterfaceSettingsFlagNameserver                  = 0x0002
	DnsInterfaceSettingsFlagSearchList                  = 0x0004
	DnsInterfaceSettingsFlagRegistrationEnabled         = 0x0008
	DnsInterfaceSettingsFlagRegisterAdapterName         = 0x0010
	DnsInterfaceSettingsFlagDomain                      = 0x0020
	DnsInterfaceSettingsFlagHostname                    = 0x0040
	DnsInterfaceSettingsFlagEnableLLMNR                 = 0x0080
	DnsInterfaceSettingsFlagQueryAdapterName            = 0x0100
	DnsInterfaceSettingsFlagProfileNameserver           = 0x0200
	DnsInterfaceSettingsFlagDisableUnconstrainedQueries = 0x0400 // v2 only
	DnsInterfaceSettingsFlagSupplementalSearchList      = 0x0800 // v2 only
	DnsInterfaceSettingsFlagDOH                         = 0x1000 // v3 only
	DnsInterfaceSettingsFlagDOHProfile                  = 0x2000 // v3 only
)

Variables

This section is empty.

Functions

func SetInterfaceDnsSettings

func SetInterfaceDnsSettings(guid windows.GUID, settings *DnsInterfaceSettings) error

The GUID is passed by value, not by reference, which means different things on different calling conventions. On amd64, this means it's passed by reference anyway, while on arm, arm64, and 386, it's split into words.

Types

type AddressFamily

type AddressFamily uint16

AddressFamily enumeration specifies protocol family and is one of the windows.AF_* constants.

type ChangeCallback

type ChangeCallback interface {
	Unregister() error
}

type DadState

type DadState uint32

DadState enumeration specifies information about the duplicate address detection (DAD) state for an IPv4 or IPv6 address. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ne-nldef-nl_dad_state

const (
	DadStateInvalid DadState = iota
	DadStateTentative
	DadStateDuplicate
	DadStateDeprecated
	DadStatePreferred
)

type DnsInterfaceSettings

type DnsInterfaceSettings struct {
	Version uint32

	Flags               uint64
	Domain              *uint16
	NameServer          *uint16
	SearchList          *uint16
	RegistrationEnabled uint32
	RegisterAdapterName uint32
	EnableLLMNR         uint32
	QueryAdapterName    uint32
	ProfileNameServer   *uint16
	// contains filtered or unexported fields
}

DnsInterfaceSettings is meant to be used with SetInterfaceDnsSettings

type GAAFlags

type GAAFlags uint32

GAAFlags enumeration defines flags used in GetAdaptersAddresses calls https://docs.microsoft.com/en-us/windows/desktop/api/iphlpapi/nf-iphlpapi-getadaptersaddresses

const (
	GAAFlagSkipUnicast GAAFlags = 1 << iota
	GAAFlagSkipAnycast
	GAAFlagSkipMulticast
	GAAFlagSkipDNSServer
	GAAFlagIncludePrefix
	GAAFlagSkipFriendlyName
	GAAFlagIncludeWinsInfo
	GAAFlagIncludeGateways
	GAAFlagIncludeAllInterfaces
	GAAFlagIncludeAllCompartments
	GAAFlagIncludeTunnelBindingOrder
	GAAFlagSkipDNSInfo

	GAAFlagDefault    GAAFlags = 0
	GAAFlagSkipAll             = GAAFlagSkipUnicast | GAAFlagSkipAnycast | GAAFlagSkipMulticast | GAAFlagSkipDNSServer | GAAFlagSkipFriendlyName | GAAFlagSkipDNSInfo
	GAAFlagIncludeAll          = GAAFlagIncludePrefix | GAAFlagIncludeWinsInfo | GAAFlagIncludeGateways | GAAFlagIncludeAllInterfaces | GAAFlagIncludeAllCompartments | GAAFlagIncludeTunnelBindingOrder
)

type IPAAFlags

type IPAAFlags uint32

IPAAFlags enumeration describes adapter addresses flags https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_addresses_lh

const (
	IPAAFlagDdnsEnabled IPAAFlags = 1 << iota
	IPAAFlagRegisterAdapterSuffix
	IPAAFlagDhcpv4Enabled
	IPAAFlagReceiveOnly
	IPAAFlagNoMulticast
	IPAAFlagIpv6OtherStatefulConfig
	IPAAFlagNetbiosOverTcpipEnabled
	IPAAFlagIpv4Enabled
	IPAAFlagIpv6Enabled
	IPAAFlagIpv6ManagedAddressConfigurationSupported
)

type IPAdapterAddresses

type IPAdapterAddresses struct {
	Length  uint32
	IfIndex uint32
	Next    *IPAdapterAddresses

	FirstUnicastAddress   *windows.IpAdapterUnicastAddress
	FirstAnycastAddress   *windows.IpAdapterAnycastAddress
	FirstMulticastAddress *windows.IpAdapterMulticastAddress
	FirstDNSServerAddress *windows.IpAdapterDnsServerAdapter

	Flags                  IPAAFlags
	MTU                    uint32
	IfType                 IfType
	OperStatus             IfOperStatus
	IPv6IfIndex            uint32
	ZoneIndices            [16]uint32
	FirstPrefix            *windows.IpAdapterPrefix
	TransmitLinkSpeed      uint64
	ReceiveLinkSpeed       uint64
	FirstWINSServerAddress *IPAdapterWINSServerAddress
	FirstGatewayAddress    *IPAdapterGatewayAddress
	Ipv4Metric             uint32
	Ipv6Metric             uint32
	LUID                   LUID
	DHCPv4Server           windows.SocketAddress
	CompartmentID          uint32
	NetworkGUID            windows.GUID
	ConnectionType         NetIfConnectionType
	TunnelType             TunnelType
	DHCPv6Server           windows.SocketAddress

	DHCPv6IAID     uint32
	FirstDNSSuffix *IPAdapterDNSSuffix
	// contains filtered or unexported fields
}

IPAdapterAddresses structure is the header node for a linked list of addresses for a particular adapter. This structure can simultaneously be used as part of a linked list of IP_ADAPTER_ADDRESSES structures. https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_addresses_lh This is a modified and extended version of windows.IpAdapterAddresses.

func GetAdaptersAddresses

func GetAdaptersAddresses(family AddressFamily, flags GAAFlags) ([]*IPAdapterAddresses, error)

GetAdaptersAddresses function retrieves the addresses associated with the adapters on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/iphlpapi/nf-iphlpapi-getadaptersaddresses

func (*IPAdapterAddresses) AdapterName

func (addr *IPAdapterAddresses) AdapterName() string

AdapterName method returns the name of the adapter with which these addresses are associated. Unlike an adapter's friendly name, the adapter name returned by AdapterName is permanent and cannot be modified by the user.

func (*IPAdapterAddresses) DHCPv6ClientDUID

func (addr *IPAdapterAddresses) DHCPv6ClientDUID() []byte

DHCPv6ClientDUID method returns the DHCP unique identifier (DUID) for the DHCPv6 client. This information is only applicable to an IPv6 adapter address configured using DHCPv6.

func (*IPAdapterAddresses) DNSSuffix

func (addr *IPAdapterAddresses) DNSSuffix() string

DNSSuffix method returns adapter DNS suffix associated with this adapter.

func (*IPAdapterAddresses) Description

func (addr *IPAdapterAddresses) Description() string

Description method returns description for the adapter.

func (*IPAdapterAddresses) FriendlyName

func (addr *IPAdapterAddresses) FriendlyName() string

FriendlyName method returns a user-friendly name for the adapter. For example: "Local Area Connection 1." This name appears in contexts such as the ipconfig command line program and the Connection folder.

func (*IPAdapterAddresses) PhysicalAddress

func (addr *IPAdapterAddresses) PhysicalAddress() []byte

PhysicalAddress method returns the Media Access Control (MAC) address for the adapter. For example, on an Ethernet network this member would specify the Ethernet hardware address.

type IPAdapterDNSSuffix

type IPAdapterDNSSuffix struct {
	Next *IPAdapterDNSSuffix
	// contains filtered or unexported fields
}

IPAdapterDNSSuffix structure stores a DNS suffix in a linked list of DNS suffixes for a particular adapter. https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_dns_suffix

func (*IPAdapterDNSSuffix) String

func (obj *IPAdapterDNSSuffix) String() string

String method returns the DNS suffix for this DNS suffix entry.

type IPAdapterGatewayAddress

type IPAdapterGatewayAddress struct {
	Length uint32

	Next    *IPAdapterGatewayAddress
	Address windows.SocketAddress
	// contains filtered or unexported fields
}

IPAdapterGatewayAddress structure stores a single gateway address in a linked list of gateway addresses for a particular adapter. https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_gateway_address_lh

type IPAdapterWINSServerAddress

type IPAdapterWINSServerAddress struct {
	Length uint32

	Next    *IPAdapterWINSServerAddress
	Address windows.SocketAddress
	// contains filtered or unexported fields
}

IPAdapterWINSServerAddress structure stores a single Windows Internet Name Service (WINS) server address in a linked list of WINS server addresses for a particular adapter. https://docs.microsoft.com/en-us/windows/desktop/api/iptypes/ns-iptypes-_ip_adapter_wins_server_address_lh

type IPAddressPrefix

type IPAddressPrefix struct {
	RawPrefix    RawSockaddrInet
	PrefixLength uint8
	// contains filtered or unexported fields
}

IPAddressPrefix structure stores an IP address prefix. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_ip_address_prefix

func (*IPAddressPrefix) Prefix

func (prefix *IPAddressPrefix) Prefix() netip.Prefix

Prefix returns IP address prefix as netip.Prefix.

func (*IPAddressPrefix) SetPrefix

func (prefix *IPAddressPrefix) SetPrefix(netPrefix netip.Prefix) error

SetPrefix method sets IP address prefix using netip.Prefix.

type IfOperStatus

type IfOperStatus uint32

IfOperStatus enumeration specifies the operational status of an interface. https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-if_oper_status

const (
	IfOperStatusUp IfOperStatus = iota + 1
	IfOperStatusDown
	IfOperStatusTesting
	IfOperStatusUnknown
	IfOperStatusDormant
	IfOperStatusNotPresent
	IfOperStatusLowerLayerDown
)

type IfType

type IfType uint32

IfType enumeration specifies interface type.

type InterfaceAndOperStatusFlags

type InterfaceAndOperStatusFlags uint8

InterfaceAndOperStatusFlags enumeration type defines interface and operation flags https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_if_row2

const (
	IAOSFHardwareInterface InterfaceAndOperStatusFlags = 1 << iota
	IAOSFFilterInterface
	IAOSFConnectorPresent
	IAOSFNotAuthenticated
	IAOSFNotMediaConnected
	IAOSFPaused
	IAOSFLowPower
	IAOSFEndPointInterface
)

type InterfaceChangeCallback

type InterfaceChangeCallback struct {
	// contains filtered or unexported fields
}

InterfaceChangeCallback structure allows interface change callback handling.

func RegisterInterfaceChangeCallback

func RegisterInterfaceChangeCallback(callback func(notificationType MibNotificationType, iface *MibIPInterfaceRow)) (*InterfaceChangeCallback, error)

RegisterInterfaceChangeCallback registers a new InterfaceChangeCallback. If this particular callback is already registered, the function will silently return. Returned InterfaceChangeCallback.Unregister method should be used to unregister.

func (*InterfaceChangeCallback) Unregister

func (callback *InterfaceChangeCallback) Unregister() error

Unregister unregisters the callback.

type LUID

type LUID uint64

LUID represents a network interface.

func LUIDFromGUID

func LUIDFromGUID(guid *windows.GUID) (LUID, error)

LUIDFromGUID function converts a globally unique identifier (GUID) for a network interface to the locally unique identifier (LUID) for the interface. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-convertinterfaceguidtoluid

func LUIDFromIndex

func LUIDFromIndex(index uint32) (LUID, error)

LUIDFromIndex function converts a local index for a network interface to the locally unique identifier (LUID) for the interface. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-convertinterfaceindextoluid

func (LUID) AddIPAddress

func (luid LUID) AddIPAddress(address netip.Prefix) error

AddIPAddress method adds new unicast IP address to the interface. Corresponds to CreateUnicastIpAddressEntry function (https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-createunicastipaddressentry).

func (LUID) AddIPAddresses

func (luid LUID) AddIPAddresses(addresses []netip.Prefix) error

AddIPAddresses method adds multiple new unicast IP addresses to the interface. Corresponds to CreateUnicastIpAddressEntry function (https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-createunicastipaddressentry).

func (LUID) AddRoute

func (luid LUID) AddRoute(destination netip.Prefix, nextHop netip.Addr, metric uint32) error

AddRoute method adds a route to the interface. Corresponds to CreateIpForwardEntry2 function, with added splitDefault feature. (https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-createipforwardentry2)

func (LUID) AddRoutes

func (luid LUID) AddRoutes(routesData []*RouteData) error

AddRoutes method adds multiple routes to the interface.

func (LUID) DNS

func (luid LUID) DNS() ([]netip.Addr, error)

DNS method returns all DNS server addresses associated with the adapter.

func (LUID) DeleteIPAddress

func (luid LUID) DeleteIPAddress(address netip.Prefix) error

DeleteIPAddress method deletes interface's unicast IP address. Corresponds to DeleteUnicastIpAddressEntry function (https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-deleteunicastipaddressentry).

func (LUID) DeleteRoute

func (luid LUID) DeleteRoute(destination netip.Prefix, nextHop netip.Addr) error

DeleteRoute method deletes a route that matches the criteria. Corresponds to DeleteIpForwardEntry2 function (https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-deleteipforwardentry2).

func (LUID) DisableDNSRegistration

func (luid LUID) DisableDNSRegistration() error

func (LUID) FlushDNS

func (luid LUID) FlushDNS(family AddressFamily) error

FlushDNS method clears all DNS servers associated with the adapter.

func (LUID) FlushIPAddresses

func (luid LUID) FlushIPAddresses(family AddressFamily) error

FlushIPAddresses method deletes all interface's unicast IP addresses.

func (LUID) FlushRoutes

func (luid LUID) FlushRoutes(family AddressFamily) error

FlushRoutes method deletes all interface's routes. It continues on failures, and returns the last error afterwards.

func (LUID) GUID

func (luid LUID) GUID() (*windows.GUID, error)

GUID method converts a locally unique identifier (LUID) for a network interface to a globally unique identifier (GUID) for the interface. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-convertinterfaceluidtoguid

func (LUID) IPAddress

func (luid LUID) IPAddress(addr netip.Addr) (*MibUnicastIPAddressRow, error)

IPAddress method returns MibUnicastIPAddressRow struct that matches to provided 'ip' argument. Corresponds to GetUnicastIpAddressEntry (https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getunicastipaddressentry)

func (LUID) IPInterface

func (luid LUID) IPInterface(family AddressFamily) (*MibIPInterfaceRow, error)

IPInterface method retrieves IP information for the specified interface on the local computer.

func (LUID) Interface

func (luid LUID) Interface() (*MibIfRow2, error)

Interface method retrieves information for the specified adapter on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getifentry2

func (LUID) Route

func (luid LUID) Route(destination netip.Prefix, nextHop netip.Addr) (*MibIPforwardRow2, error)

Route method returns route determined with the input arguments. Corresponds to GetIpForwardEntry2 function (https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getipforwardentry2). NOTE: If the corresponding route isn't found, the method will return error.

func (LUID) SetDNS

func (luid LUID) SetDNS(family AddressFamily, servers []netip.Addr, domains []string) error

SetDNS method clears previous and associates new DNS servers and search domains with the adapter for a specific family.

func (LUID) SetIPAddresses

func (luid LUID) SetIPAddresses(addresses []netip.Prefix) error

SetIPAddresses method sets new unicast IP addresses to the interface.

func (LUID) SetIPAddressesForFamily

func (luid LUID) SetIPAddressesForFamily(family AddressFamily, addresses []netip.Prefix) error

SetIPAddressesForFamily method sets new unicast IP addresses for a specific family to the interface.

func (LUID) SetRoutes

func (luid LUID) SetRoutes(routesData []*RouteData) error

SetRoutes method sets (flush than add) multiple routes to the interface.

func (LUID) SetRoutesForFamily

func (luid LUID) SetRoutesForFamily(family AddressFamily, routesData []*RouteData) error

SetRoutesForFamily method sets (flush than add) multiple routes for a specific family to the interface.

type LinkLocalAddressBehavior

type LinkLocalAddressBehavior int32

LinkLocalAddressBehavior enumeration type defines the link local address behavior. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ne-nldef-_nl_link_local_address_behavior

const (
	LinkLocalAddressAlwaysOff LinkLocalAddressBehavior = iota // Never use link locals.
	LinkLocalAddressDelayed                                   // Use link locals only if no other addresses. (default for IPv4). Legacy mapping: IPAutoconfigurationEnabled.
	LinkLocalAddressAlwaysOn                                  // Always use link locals (default for IPv6).
	LinkLocalAddressUnchanged = -1
)

type MibAnycastIPAddressRow

type MibAnycastIPAddressRow struct {
	Address        RawSockaddrInet
	InterfaceLUID  LUID
	InterfaceIndex uint32
	ScopeID        uint32
}

MibAnycastIPAddressRow structure stores information about an anycast IP address. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_anycastipaddress_row

func GetAnycastIPAddressTable

func GetAnycastIPAddressTable(family AddressFamily) ([]MibAnycastIPAddressRow, error)

GetAnycastIPAddressTable function retrieves the anycast IP address table on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getanycastipaddresstable

func (*MibAnycastIPAddressRow) Create

func (row *MibAnycastIPAddressRow) Create() error

Create method adds a new anycast IP address entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-createanycastipaddressentry

func (*MibAnycastIPAddressRow) Delete

func (row *MibAnycastIPAddressRow) Delete() error

Delete method deletes an existing anycast IP address entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-deleteanycastipaddressentry

type MibIPInterfaceRow

type MibIPInterfaceRow struct {
	Family                               AddressFamily
	InterfaceLUID                        LUID
	InterfaceIndex                       uint32
	MaxReassemblySize                    uint32
	InterfaceIdentifier                  uint64
	MinRouterAdvertisementInterval       uint32
	MaxRouterAdvertisementInterval       uint32
	AdvertisingEnabled                   bool
	ForwardingEnabled                    bool
	WeakHostSend                         bool
	WeakHostReceive                      bool
	UseAutomaticMetric                   bool
	UseNeighborUnreachabilityDetection   bool
	ManagedAddressConfigurationSupported bool
	OtherStatefulConfigurationSupported  bool
	AdvertiseDefaultRoute                bool
	RouterDiscoveryBehavior              RouterDiscoveryBehavior
	DadTransmits                         uint32
	BaseReachableTime                    uint32
	RetransmitTime                       uint32
	PathMTUDiscoveryTimeout              uint32
	LinkLocalAddressBehavior             LinkLocalAddressBehavior
	LinkLocalAddressTimeout              uint32
	ZoneIndices                          [ScopeLevelCount]uint32
	SitePrefixLength                     uint32
	Metric                               uint32
	NLMTU                                uint32
	Connected                            bool
	SupportsWakeUpPatterns               bool
	SupportsNeighborDiscovery            bool
	SupportsRouterDiscovery              bool
	ReachableTime                        uint32
	TransmitOffload                      OffloadRod
	ReceiveOffload                       OffloadRod
	DisableDefaultRoutes                 bool
}

MibIPInterfaceRow structure stores interface management information for a particular IP address family on a network interface. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_ipinterface_row

func GetIPInterfaceTable

func GetIPInterfaceTable(family AddressFamily) ([]MibIPInterfaceRow, error)

GetIPInterfaceTable function retrieves the IP interface entries on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getipinterfacetable

func (*MibIPInterfaceRow) Init

func (row *MibIPInterfaceRow) Init()

Init method initializes the members of an MIB_IPINTERFACE_ROW entry with default values. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-initializeipinterfaceentry

func (*MibIPInterfaceRow) Set

func (row *MibIPInterfaceRow) Set() error

Set method sets the properties of an IP interface on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-setipinterfaceentry

type MibIPforwardRow2

type MibIPforwardRow2 struct {
	InterfaceLUID        LUID
	InterfaceIndex       uint32
	DestinationPrefix    IPAddressPrefix
	NextHop              RawSockaddrInet
	SitePrefixLength     uint8
	ValidLifetime        uint32
	PreferredLifetime    uint32
	Metric               uint32
	Protocol             RouteProtocol
	Loopback             bool
	AutoconfigureAddress bool
	Publish              bool
	Immortal             bool
	Age                  uint32
	Origin               RouteOrigin
}

MibIPforwardRow2 structure stores information about an IP route entry. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_ipforward_row2

func GetIPForwardTable2

func GetIPForwardTable2(family AddressFamily) ([]MibIPforwardRow2, error)

GetIPForwardTable2 function retrieves the IP route entries on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getipforwardtable2

func (*MibIPforwardRow2) Create

func (row *MibIPforwardRow2) Create() error

Create method creates a new IP route entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-createipforwardentry2

func (*MibIPforwardRow2) Delete

func (row *MibIPforwardRow2) Delete() error

Delete method deletes an IP route entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-deleteipforwardentry2

func (*MibIPforwardRow2) Init

func (row *MibIPforwardRow2) Init()

Init method initializes a MIB_IPFORWARD_ROW2 structure with default values for an IP route entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-initializeipforwardentry

func (*MibIPforwardRow2) Set

func (row *MibIPforwardRow2) Set() error

Set method sets the properties of an IP route entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-setipforwardentry2

type MibIfEntryLevel

type MibIfEntryLevel uint32

MibIfEntryLevel enumeration specifies level of interface information to retrieve in GetIfTable2Ex function call. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getifentry2ex

const (
	MibIfEntryNormal                  MibIfEntryLevel = 0
	MibIfEntryNormalWithoutStatistics                 = 2
)

type MibIfRow2

type MibIfRow2 struct {
	InterfaceLUID  LUID
	InterfaceIndex uint32
	InterfaceGUID  windows.GUID

	MTU                         uint32
	Type                        IfType
	TunnelType                  TunnelType
	MediaType                   NdisMedium
	PhysicalMediumType          NdisPhysicalMedium
	AccessType                  NetIfAccessType
	DirectionType               NetIfDirectionType
	InterfaceAndOperStatusFlags InterfaceAndOperStatusFlags
	OperStatus                  IfOperStatus
	AdminStatus                 NetIfAdminStatus
	MediaConnectState           NetIfMediaConnectState
	NetworkGUID                 windows.GUID
	ConnectionType              NetIfConnectionType
	TransmitLinkSpeed           uint64
	ReceiveLinkSpeed            uint64
	InOctets                    uint64
	InUcastPkts                 uint64
	InNUcastPkts                uint64
	InDiscards                  uint64
	InErrors                    uint64
	InUnknownProtos             uint64
	InUcastOctets               uint64
	InMulticastOctets           uint64
	InBroadcastOctets           uint64
	OutOctets                   uint64
	OutUcastPkts                uint64
	OutNUcastPkts               uint64
	OutDiscards                 uint64
	OutErrors                   uint64
	OutUcastOctets              uint64
	OutMulticastOctets          uint64
	OutBroadcastOctets          uint64
	OutQLen                     uint64
	// contains filtered or unexported fields
}

MibIfRow2 structure stores information about a particular interface. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_if_row2

func GetIfTable2Ex

func GetIfTable2Ex(level MibIfEntryLevel) ([]MibIfRow2, error)

GetIfTable2Ex function retrieves the MIB-II interface table. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getiftable2ex

func (*MibIfRow2) Alias

func (row *MibIfRow2) Alias() string

Alias method returns a string that contains the alias name of the network interface.

func (*MibIfRow2) Description

func (row *MibIfRow2) Description() string

Description method returns a string that contains a description of the network interface.

func (*MibIfRow2) PermanentPhysicalAddress

func (row *MibIfRow2) PermanentPhysicalAddress() []byte

PermanentPhysicalAddress method returns the permanent physical hardware address of the adapter for this network interface.

func (*MibIfRow2) PhysicalAddress

func (row *MibIfRow2) PhysicalAddress() []byte

PhysicalAddress method returns the physical hardware address of the adapter for this network interface.

type MibNotificationType

type MibNotificationType uint32

MibNotificationType enumeration defines the notification type passed to a callback function when a notification occurs. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ne-netioapi-_mib_notification_type

const (
	MibParameterNotification MibNotificationType = iota // Parameter change
	MibAddInstance                                      // Addition
	MibDeleteInstance                                   // Deletion
	MibInitialNotification                              // Initial notification
)

type MibUnicastIPAddressRow

type MibUnicastIPAddressRow struct {
	Address            RawSockaddrInet
	InterfaceLUID      LUID
	InterfaceIndex     uint32
	PrefixOrigin       PrefixOrigin
	SuffixOrigin       SuffixOrigin
	ValidLifetime      uint32
	PreferredLifetime  uint32
	OnLinkPrefixLength uint8
	SkipAsSource       bool
	DadState           DadState
	ScopeID            uint32
	CreationTimeStamp  int64
}

MibUnicastIPAddressRow structure stores information about a unicast IP address. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_unicastipaddress_row

func GetUnicastIPAddressTable

func GetUnicastIPAddressTable(family AddressFamily) ([]MibUnicastIPAddressRow, error)

GetUnicastIPAddressTable function retrieves the unicast IP address table on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-getunicastipaddresstable

func (*MibUnicastIPAddressRow) Create

func (row *MibUnicastIPAddressRow) Create() error

Create method adds a new unicast IP address entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-createunicastipaddressentry

func (*MibUnicastIPAddressRow) Delete

func (row *MibUnicastIPAddressRow) Delete() error

Delete method deletes an existing unicast IP address entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-deleteunicastipaddressentry

func (*MibUnicastIPAddressRow) Init

func (row *MibUnicastIPAddressRow) Init()

Init method initializes a MibUnicastIPAddressRow structure with default values for a unicast IP address entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-initializeunicastipaddressentry

func (*MibUnicastIPAddressRow) Set

func (row *MibUnicastIPAddressRow) Set() error

Set method sets the properties of an existing unicast IP address entry on the local computer. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-setunicastipaddressentry

type NdisMedium

type NdisMedium uint32

NdisMedium enumeration type identifies the medium types that NDIS drivers support. https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddndis/ne-ntddndis-_ndis_medium

const (
	NdisMedium802_3 NdisMedium = iota
	NdisMedium802_5
	NdisMediumFddi
	NdisMediumWan
	NdisMediumLocalTalk
	NdisMediumDix // defined for convenience, not a real medium
	NdisMediumArcnetRaw
	NdisMediumArcnet878_2
	NdisMediumAtm
	NdisMediumWirelessWan
	NdisMediumIrda
	NdisMediumBpc
	NdisMediumCoWan
	NdisMedium1394
	NdisMediumInfiniBand
	NdisMediumTunnel
	NdisMediumNative802_11
	NdisMediumLoopback
	NdisMediumWiMAX
	NdisMediumIP
	NdisMediumMax
)

type NdisPhysicalMedium

type NdisPhysicalMedium uint32

NdisPhysicalMedium describes NDIS physical medium type. https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/ns-netioapi-_mib_if_row2

const (
	NdisPhysicalMediumUnspecified NdisPhysicalMedium = iota
	NdisPhysicalMediumWirelessLan
	NdisPhysicalMediumCableModem
	NdisPhysicalMediumPhoneLine
	NdisPhysicalMediumPowerLine
	NdisPhysicalMediumDSL // includes ADSL and UADSL (G.Lite)
	NdisPhysicalMediumFibreChannel
	NdisPhysicalMedium1394
	NdisPhysicalMediumWirelessWan
	NdisPhysicalMediumNative802_11
	NdisPhysicalMediumBluetooth
	NdisPhysicalMediumInfiniband
	NdisPhysicalMediumWiMax
	NdisPhysicalMediumUWB
	NdisPhysicalMedium802_3
	NdisPhysicalMedium802_5
	NdisPhysicalMediumIrda
	NdisPhysicalMediumWiredWAN
	NdisPhysicalMediumWiredCoWan
	NdisPhysicalMediumOther
	NdisPhysicalMediumNative802_15_4
	NdisPhysicalMediumMax
)

type NetIfAccessType

type NetIfAccessType uint32

NetIfAccessType enumeration type specifies the NDIS network interface access type. https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-_net_if_access_type

const (
	NetIfAccessLoopback NetIfAccessType = iota + 1
	NetIfAccessBroadcast
	NetIfAccessPointToPoint
	NetIfAccessPointToMultiPoint
	NetIfAccessMax
)

type NetIfAdminStatus

type NetIfAdminStatus uint32

NetIfAdminStatus enumeration type specifies the NDIS network interface administrative status, as described in RFC 2863. https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-net_if_admin_status

const (
	NetIfAdminStatusUp NetIfAdminStatus = iota + 1
	NetIfAdminStatusDown
	NetIfAdminStatusTesting
)

type NetIfConnectionType

type NetIfConnectionType uint32

NetIfConnectionType enumeration type specifies the NDIS network interface connection type. https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-_net_if_connection_type

const (
	NetIfConnectionDedicated NetIfConnectionType = iota + 1
	NetIfConnectionPassive
	NetIfConnectionDemand
	NetIfConnectionMaximum
)

type NetIfDirectionType

type NetIfDirectionType uint32

NetIfDirectionType enumeration type specifies the NDIS network interface direction type. https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-net_if_direction_type

const (
	NetIfDirectionSendReceive NetIfDirectionType = iota
	NetIfDirectionSendOnly
	NetIfDirectionReceiveOnly
	NetIfDirectionMaximum
)

type NetIfMediaConnectState

type NetIfMediaConnectState uint32

NetIfMediaConnectState enumeration type specifies the NDIS network interface connection state. https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-_net_if_media_connect_state

const (
	MediaConnectStateUnknown NetIfMediaConnectState = iota
	MediaConnectStateConnected
	MediaConnectStateDisconnected
)

type OffloadRod

type OffloadRod uint8

OffloadRod enumeration specifies a set of flags that indicate the offload capabilities for an IP interface. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ns-nldef-_nl_interface_offload_rod

const (
	ChecksumSupported OffloadRod = 1 << iota
	OptionsSupported
	DatagramChecksumSupported
	StreamChecksumSupported
	StreamOptionsSupported
	FastPathCompatible
	LargeSendOffloadSupported
	GiantSendOffloadSupported
)

type PrefixOrigin

type PrefixOrigin uint32

PrefixOrigin enumeration specifies the origin of an IPv4 or IPv6 address prefix, and is used with the IP_ADAPTER_UNICAST_ADDRESS structure. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ne-nldef-nl_prefix_origin

const (
	PrefixOriginOther PrefixOrigin = iota
	PrefixOriginManual
	PrefixOriginWellKnown
	PrefixOriginDHCP
	PrefixOriginRouterAdvertisement
	PrefixOriginUnchanged = 1 << 4
)

type RawSockaddrInet

type RawSockaddrInet struct {
	Family AddressFamily
	// contains filtered or unexported fields
}

RawSockaddrInet union contains an IPv4, an IPv6 address, or an address family. https://docs.microsoft.com/en-us/windows/desktop/api/ws2ipdef/ns-ws2ipdef-_sockaddr_inet

func (*RawSockaddrInet) Addr

func (addr *RawSockaddrInet) Addr() netip.Addr

Addr returns IPv4 or IPv6 address, or an invalid address if the address is neither.

func (*RawSockaddrInet) AddrPort

func (addr *RawSockaddrInet) AddrPort() netip.AddrPort

AddrPort returns the IP address and port.

func (*RawSockaddrInet) Port

func (addr *RawSockaddrInet) Port() uint16

Port returns the port if the address if IPv4 or IPv6, or 0 if neither.

func (*RawSockaddrInet) SetAddr

func (addr *RawSockaddrInet) SetAddr(netAddr netip.Addr) error

SetAddr method sets family and address to the given IPv4 or IPv6 address. All other members of the structure are set to zero.

func (*RawSockaddrInet) SetAddrPort

func (addr *RawSockaddrInet) SetAddrPort(addrPort netip.AddrPort) error

SetAddrPort method sets family, address, and port to the given IPv4 or IPv6 address and port. All other members of the structure are set to zero.

type RouteChangeCallback

type RouteChangeCallback struct {
	// contains filtered or unexported fields
}

RouteChangeCallback structure allows route change callback handling.

func RegisterRouteChangeCallback

func RegisterRouteChangeCallback(callback func(notificationType MibNotificationType, route *MibIPforwardRow2)) (*RouteChangeCallback, error)

RegisterRouteChangeCallback registers a new RouteChangeCallback. If this particular callback is already registered, the function will silently return. Returned RouteChangeCallback.Unregister method should be used to unregister.

func (*RouteChangeCallback) Unregister

func (callback *RouteChangeCallback) Unregister() error

Unregister unregisters the callback.

type RouteData

type RouteData struct {
	Destination netip.Prefix
	NextHop     netip.Addr
	Metric      uint32
}

RouteData structure describes a route to add

func (*RouteData) String

func (routeData *RouteData) String() string

type RouteOrigin

type RouteOrigin uint32

RouteOrigin enumeration type defines the origin of the IP route. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ne-nldef-nl_route_origin

const (
	RouteOriginManual RouteOrigin = iota
	RouteOriginWellKnown
	RouteOriginDHCP
	RouteOriginRouterAdvertisement
	RouteOrigin6to4
)

type RouteProtocol

type RouteProtocol uint32

RouteProtocol enumeration type defines the routing mechanism that an IP route was added with, as described in RFC 4292. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ne-nldef-nl_route_protocol

const (
	RouteProtocolOther RouteProtocol = iota + 1
	RouteProtocolLocal
	RouteProtocolNetMgmt
	RouteProtocolIcmp
	RouteProtocolEgp
	RouteProtocolGgp
	RouteProtocolHello
	RouteProtocolRip
	RouteProtocolIsIs
	RouteProtocolEsIs
	RouteProtocolCisco
	RouteProtocolBbn
	RouteProtocolOspf
	RouteProtocolBgp
	RouteProtocolIdpr
	RouteProtocolEigrp
	RouteProtocolDvmrp
	RouteProtocolRpl
	RouteProtocolDHCP
	RouteProtocolNTAutostatic   = 10002
	RouteProtocolNTStatic       = 10006
	RouteProtocolNTStaticNonDOD = 10007
)

type RouterDiscoveryBehavior

type RouterDiscoveryBehavior int32

RouterDiscoveryBehavior enumeration type defines the router discovery behavior, as described in RFC 2461. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ne-nldef-_nl_router_discovery_behavior

const (
	RouterDiscoveryDisabled RouterDiscoveryBehavior = iota
	RouterDiscoveryEnabled
	RouterDiscoveryDHCP
	RouterDiscoveryUnchanged = -1
)

type ScopeLevel

type ScopeLevel uint32

ScopeLevel enumeration is used with the IP_ADAPTER_ADDRESSES structure to identify scope levels for IPv6 addresses. https://docs.microsoft.com/en-us/windows/desktop/api/ws2def/ne-ws2def-scope_level

type SuffixOrigin

type SuffixOrigin uint32

SuffixOrigin enumeration specifies the origin of an IPv4 or IPv6 address suffix, and is used with the IP_ADAPTER_UNICAST_ADDRESS structure. https://docs.microsoft.com/en-us/windows/desktop/api/nldef/ne-nldef-nl_suffix_origin

const (
	SuffixOriginOther SuffixOrigin = iota
	SuffixOriginManual
	SuffixOriginWellKnown
	SuffixOriginDHCP
	SuffixOriginLinkLayerAddress
	SuffixOriginRandom
	SuffixOriginUnchanged = 1 << 4
)

type TunnelType

type TunnelType uint32

TunnelType enumeration type defines the encapsulation method used by a tunnel, as described by the Internet Assigned Names Authority (IANA). https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-tunnel_type

type UnicastAddressChangeCallback

type UnicastAddressChangeCallback struct {
	// contains filtered or unexported fields
}

UnicastAddressChangeCallback structure allows unicast address change callback handling.

func RegisterUnicastAddressChangeCallback

func RegisterUnicastAddressChangeCallback(callback func(notificationType MibNotificationType, unicastAddress *MibUnicastIPAddressRow)) (*UnicastAddressChangeCallback, error)

RegisterUnicastAddressChangeCallback registers a new UnicastAddressChangeCallback. If this particular callback is already registered, the function will silently return. Returned UnicastAddressChangeCallback.Unregister method should be used to unregister.

func (*UnicastAddressChangeCallback) Unregister

func (callback *UnicastAddressChangeCallback) Unregister() error

Unregister unregisters the callback.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL