• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.circleci/H01-Jul-2020-1210

LICENSEH A D01-Jul-20201.6 KiB3026

README.mdH A D01-Jul-20202 KiB6141

common.goH A D01-Jul-20203.8 KiB160127

go.modH A D01-Jul-2020239 118

go.sumH A D01-Jul-20201.1 KiB1312

netroute_bsd.goH A D01-Jul-20203.7 KiB154127

netroute_linux.goH A D01-Jul-20202.8 KiB11294

netroute_plan9.goH A D01-Jul-20203.3 KiB142119

netroute_test.goH A D01-Jul-20201.5 KiB7161

netroute_windows.goH A D01-Jul-20206.3 KiB239199

README.md

1Go Netroute
2===
3
4[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
5[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://github.com/libp2p/libp2p)
6[![Build Status](https://travis-ci.com/libp2p/go-netroute.svg?branch=master)](https://travis-ci.com/libp2p/go-netroute)
7
8A cross-platform implementation of the [`gopacket/routing.Router`](https://godoc.org/github.com/google/gopacket/routing#Router) interface.
9
10This library is derived from `gopacket` for linux, `x/net/route` for mac, and `iphlpapi.dll` for windows.
11
12## Table of Contents
13
14- [Install](#install)
15- [Usage](#usage)
16- [Documentation](#documentation)
17- [Contribute](#contribute)
18- [License](#license)
19
20## Install
21
22```
23go get github.com/libp2p/go-netroute
24```
25
26## Usage
27
28To be used for querying the local OS routing table.
29
30```go
31import (
32    netroute "github.com/libp2p/go-netroute"
33)
34
35func main() {
36    r, err := netroute.New()
37    if err != nil {
38        panic(err)
39    }
40    iface, gw, src, err := r.Route(net.IPv4(127, 0, 0, 1))
41    fmt.Printf("%v, %v, %v, %v\n", iface, gw, src, err)
42}
43```
44
45## Documentation
46
47See the [gopacket](https://github.com/google/gopacket/blob/master/routing/) interface for thoughts on design,
48and [godoc](https://godoc.org/github.com/libp2p/go-netroute) for API documentation.
49
50## Contribute
51
52Contributions welcome. Please check out [the issues](https://github.com/libp2p/go-netroute/issues).
53
54Check out our [contributing document](https://github.com/libp2p/community/blob/master/contributing.md) 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](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
55
56Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
57
58## License
59
60[BSD](LICENSE) © Will Scott, and the Gopacket authors (i.e. Google)
61