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

..03-May-2022-

example/H23-Oct-2020-

.gitignoreH A D23-Oct-2020320

.travis.ymlH A D23-Oct-202090

LICENSEH A D23-Oct-202011.1 KiB

MakefileH A D23-Oct-202067

README.mdH A D23-Oct-20201.7 KiB

ethtool.goH A D23-Oct-202016.5 KiB

ethtool_cmd.goH A D23-Oct-20205.1 KiB

ethtool_cmd_test.goH A D23-Oct-20201.6 KiB

ethtool_msglvl.goH A D23-Oct-20202.8 KiB

ethtool_msglvl_test.goH A D23-Oct-20201.4 KiB

ethtool_test.goH A D23-Oct-20202 KiB

README.md

1# ethtool go package #
2
3[![Build Status](https://travis-ci.org/safchain/ethtool.png?branch=master)](https://travis-ci.org/safchain/ethtool)
4[![GoDoc](https://godoc.org/github.com/safchain/ethtool?status.svg)](https://godoc.org/github.com/safchain/ethtool)
5
6The ethtool package aims to provide a library giving a simple access to the Linux SIOCETHTOOL ioctl operations. It can be used to retrieve informations from a network device like statistics, driver related informations or even the peer of a VETH interface.
7
8## Build and Test ##
9
10go get command:
11
12    go get github.com/safchain/ethtool
13
14Testing
15
16In order to run te
17
18    go test github.com/safchain/ethtool
19
20## Examples ##
21
22```go
23package main
24
25import (
26	"fmt"
27
28	"github.com/safchain/ethtool"
29)
30
31func main() {
32	ethHandle, err := ethtool.NewEthtool()
33	if err != nil {
34		panic(err.Error())
35	}
36	defer ethHandle.Close()
37
38	// Retrieve tx from eth0
39	stats, err := ethHandle.Stats("eth0")
40	if err != nil {
41		panic(err.Error())
42	}
43	fmt.Printf("TX: %d\n", stats["tx_bytes"])
44
45	// Retrieve peer index of a veth interface
46	stats, err = ethHandle.Stats("veth0")
47	if err != nil {
48		panic(err.Error())
49	}
50	fmt.Printf("Peer Index: %d\n", stats["peer_ifindex"])
51}
52```
53
54## LICENSE ##
55
56Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
57
58http://www.apache.org/licenses/LICENSE-2.0
59
60Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
61