defaultroute

package module
v0.0.0-...-0722aff Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

README

default-route

This is tailscale.com/net/interfaces modified to have fewer dependencies and only provide the functionality of getting the default route. This was previously used for my what cli tool.

Documentation

Overview

Package defaultroute contains helpers for looking up system network interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRouteInterface

func DefaultRouteInterface() (*net.Interface, error)

DefaultRouteInterface is like DefaultRoute but only returns the interface name.

Types

type DefaultRouteDetails

type DefaultRouteDetails struct {
	// InterfaceName is the interface name. It must always be populated.
	// It's like "eth0" (Linux), "Ethernet 2" (Windows), "en0" (macOS).
	InterfaceName string

	// InterfaceDesc is populated on Windows at least. It's a
	// longer description, like "Red Hat VirtIO Ethernet Adapter".
	InterfaceDesc string

	// InterfaceIndex is like net.Interface.Index.
	// Zero means not populated.
	InterfaceIndex int
}

DefaultRouteDetails are the details about a default route returned by DefaultRoute.

func DefaultRoute

func DefaultRoute() (DefaultRouteDetails, error)

DefaultRoute returns details of the network interface that owns the default route, not including any tailscale interfaces.

Jump to

Keyboard shortcuts

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