netroute

package
v1.3.5-alpha-0814 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: AGPL-3.0, BSD-3-Clause Imports: 13 Imported by: 1

README

Go Netroute

Build Status

A cross-platform implementation of the gopacket/routing.Router interface.

This library is derived from gopacket for linux, x/net/route for mac, and iphlpapi.dll for windows.

Table of Contents

Install

go get github.com/libp2p/go-netroute

Usage

To be used for querying the local OS routing table.

import (
    netroute "github.com/libp2p/go-netroute"
)

func main() {
    r, err := netroute.New()
    if err != nil {
        panic(err)
    }
    iface, gw, src, err := r.Route(net.IPv4(127, 0, 0, 1))
    fmt.Printf("%v, %v, %v, %v\n", iface, gw, src, err)
}

Documentation

See the gopacket interface for thoughts on design, and godoc for API documentation.

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

Small note: If editing the README, please conform to the standard-readme specification.

License

BSD © Will Scott, and the Gopacket authors (i.e. Google)

Documentation

Overview

Originally found in https://github.com/google/gopacket/blob/master/routing/routing.go

  • Route selection modified to choose most selective route to break ties when route priority is insufficient.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (routing.Router, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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