Skip to content

Commit 4b9efb1

Browse files
committed
Expose NewNetTCP and NewNetUDP
1 parent 775997f commit 4b9efb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+103
-103
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ linters-settings:
2626
# Ignore "See: URL"
2727
- 'See:'
2828
goimports:
29-
local-prefixes: github.com/prometheus/procfs
29+
local-prefixes: github.com/kubeshark/procfs
3030
misspell:
3131
locale: US

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Prometheus uses GitHub to manage reviews of pull requests.
2525

2626
Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue.
2727

28-
Please check the [`help-wanted`](https://github.com/prometheus/procfs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label to find issues that are good for getting started. If you have questions about one of the issues, with or without the tag, please comment on them and one of the maintainers will clarify it. For a quicker response, contact us over [IRC](https://prometheus.io/community).
28+
Please check the [`help-wanted`](https://github.com/kubeshark/procfs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label to find issues that are good for getting started. If you have questions about one of the issues, with or without the tag, please comment on them and one of the maintainers will clarify it. For a quicker response, contact us over [IRC](https://prometheus.io/community).
2929

3030
For quickly compiling and testing your changes do:
3131
```

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ metrics from the pseudo-filesystems /proc and /sys.
66
*WARNING*: This package is a work in progress. Its API may still break in
77
backwards-incompatible ways without warnings. Use it at your own risk.
88

9-
[![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/procfs.svg)](https://pkg.go.dev/github.com/prometheus/procfs)
10-
[![CircleCI](https://circleci.com/gh/prometheus/procfs/tree/master.svg?style=svg)](https://circleci.com/gh/prometheus/procfs/tree/master)
11-
[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs)
9+
[![Go Reference](https://pkg.go.dev/badge/github.com/kubeshark/procfs.svg)](https://pkg.go.dev/github.com/kubeshark/procfs)
10+
[![CircleCI](https://circleci.com/gh/kubeshark/procfs/tree/master.svg?style=svg)](https://circleci.com/gh/kubeshark/procfs/tree/master)
11+
[![Go Report Card](https://goreportcard.com/badge/github.com/kubeshark/procfs)](https://goreportcard.com/report/github.com/kubeshark/procfs)
1212

1313
## Usage
1414

bcache/get.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"strconv"
2323
"strings"
2424

25-
"github.com/prometheus/procfs/internal/fs"
25+
"github.com/kubeshark/procfs/internal/fs"
2626
)
2727

2828
// FS represents the pseudo-filesystem proc, which provides an interface to

blockdevice/stats.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
"os"
2222
"strings"
2323

24-
"github.com/prometheus/procfs"
25-
"github.com/prometheus/procfs/internal/fs"
26-
"github.com/prometheus/procfs/internal/util"
24+
"github.com/kubeshark/procfs"
25+
"github.com/kubeshark/procfs/internal/fs"
26+
"github.com/kubeshark/procfs/internal/util"
2727
)
2828

2929
// Info contains identifying information for a block device such as a disk drive.

btrfs/get.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"strconv"
2323
"strings"
2424

25-
"github.com/prometheus/procfs"
26-
"github.com/prometheus/procfs/internal/fs"
27-
"github.com/prometheus/procfs/internal/util"
25+
"github.com/kubeshark/procfs"
26+
"github.com/kubeshark/procfs/internal/fs"
27+
"github.com/kubeshark/procfs/internal/util"
2828
)
2929

3030
// FS represents the pseudo-filesystem sys, which provides an interface to

cmdline.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package procfs
1616
import (
1717
"strings"
1818

19-
"github.com/prometheus/procfs/internal/util"
19+
"github.com/kubeshark/procfs/internal/util"
2020
)
2121

2222
// CmdLine returns the command line of the kernel.

cpuinfo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"strconv"
2626
"strings"
2727

28-
"github.com/prometheus/procfs/internal/util"
28+
"github.com/kubeshark/procfs/internal/util"
2929
)
3030

3131
// CPUInfo contains general information about a system CPU found in /proc/cpuinfo.

crypto.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"io"
2121
"strings"
2222

23-
"github.com/prometheus/procfs/internal/util"
23+
"github.com/kubeshark/procfs/internal/util"
2424
)
2525

2626
// Crypto holds info parsed from /proc/crypto.

doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// "fmt"
2323
// "log"
2424
//
25-
// "github.com/prometheus/procfs"
25+
// "github.com/kubeshark/procfs"
2626
// )
2727
//
2828
// func main() {

ext4/ext4.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
"path/filepath"
1919
"strings"
2020

21-
"github.com/prometheus/procfs/internal/fs"
22-
"github.com/prometheus/procfs/internal/util"
21+
"github.com/kubeshark/procfs/internal/fs"
22+
"github.com/kubeshark/procfs/internal/util"
2323
)
2424

2525
const (

fs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
package procfs
1515

1616
import (
17-
"github.com/prometheus/procfs/internal/fs"
17+
"github.com/kubeshark/procfs/internal/fs"
1818
)
1919

2020
// FS represents the pseudo-filesystem sys, which provides an interface to

fscache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"strconv"
2222
"strings"
2323

24-
"github.com/prometheus/procfs/internal/util"
24+
"github.com/kubeshark/procfs/internal/util"
2525
)
2626

2727
// Fscacheinfo represents fscache statistics.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/prometheus/procfs
1+
module github.com/kubeshark/procfs
22

33
go 1.21
44

internal/util/valueparser_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
"github.com/google/go-cmp/cmp"
2020

21-
"github.com/prometheus/procfs/internal/util"
21+
"github.com/kubeshark/procfs/internal/util"
2222
)
2323

2424
func TestValueParser(t *testing.T) {

ipvs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"strconv"
2626
"strings"
2727

28-
"github.com/prometheus/procfs/internal/util"
28+
"github.com/kubeshark/procfs/internal/util"
2929
)
3030

3131
// IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`.

iscsi/get.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"strconv"
2323
"strings"
2424

25-
"github.com/prometheus/procfs/internal/util"
25+
"github.com/kubeshark/procfs/internal/util"
2626
)
2727

2828
// GetStats is the main iscsi status information func for

iscsi/get_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"reflect"
1818
"testing"
1919

20-
"github.com/prometheus/procfs/iscsi"
20+
"github.com/kubeshark/procfs/iscsi"
2121
)
2222

2323
func TestGetStats(t *testing.T) {

iscsi/iscsi.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"path/filepath"
1919
"strings"
2020

21-
"github.com/prometheus/procfs/internal/fs"
21+
"github.com/kubeshark/procfs/internal/fs"
2222
)
2323

2424
// iscsi target started with /sys/kernel/config/target/iscsi/iqn*

kernel_random.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package procfs
1919
import (
2020
"os"
2121

22-
"github.com/prometheus/procfs/internal/util"
22+
"github.com/kubeshark/procfs/internal/util"
2323
)
2424

2525
// KernelRandom contains information about to the kernel's random number generator.

loadavg.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"strconv"
1919
"strings"
2020

21-
"github.com/prometheus/procfs/internal/util"
21+
"github.com/kubeshark/procfs/internal/util"
2222
)
2323

2424
// LoadAvg represents an entry in /proc/loadavg.

meminfo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"strconv"
2222
"strings"
2323

24-
"github.com/prometheus/procfs/internal/util"
24+
"github.com/kubeshark/procfs/internal/util"
2525
)
2626

2727
// Meminfo represents memory statistics.

mountinfo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"strconv"
2121
"strings"
2222

23-
"github.com/prometheus/procfs/internal/util"
23+
"github.com/kubeshark/procfs/internal/util"
2424
)
2525

2626
// A MountInfo is a type that describes the details, options

net_conntrackstat.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"io"
2121
"strings"
2222

23-
"github.com/prometheus/procfs/internal/util"
23+
"github.com/kubeshark/procfs/internal/util"
2424
)
2525

2626
// A ConntrackStatEntry represents one line from net/stat/nf_conntrack

net_protocols.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"strconv"
2121
"strings"
2222

23-
"github.com/prometheus/procfs/internal/util"
23+
"github.com/kubeshark/procfs/internal/util"
2424
)
2525

2626
// NetProtocolStats stores the contents from /proc/net/protocols.

net_route.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"strconv"
2222
"strings"
2323

24-
"github.com/prometheus/procfs/internal/util"
24+
"github.com/kubeshark/procfs/internal/util"
2525
)
2626

2727
const (

net_sockstat.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"io"
2121
"strings"
2222

23-
"github.com/prometheus/procfs/internal/util"
23+
"github.com/kubeshark/procfs/internal/util"
2424
)
2525

2626
// A NetSockstat contains the output of /proc/net/sockstat{,6} for IPv4 or IPv6,

net_softnet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"strconv"
2222
"strings"
2323

24-
"github.com/prometheus/procfs/internal/util"
24+
"github.com/kubeshark/procfs/internal/util"
2525
)
2626

2727
// For the proc file format details,

net_tcp.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ type (
2727
// read from /proc/net/tcp.
2828
// Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET) instead.
2929
func (fs FS) NetTCP() (NetTCP, error) {
30-
return newNetTCP(fs.proc.Path("net/tcp"))
30+
return NewNetTCP(fs.proc.Path("net/tcp"))
3131
}
3232

3333
// NetTCP6 returns the IPv6 kernel/networking statistics for TCP datagrams
3434
// read from /proc/net/tcp6.
3535
// Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET6) instead.
3636
func (fs FS) NetTCP6() (NetTCP, error) {
37-
return newNetTCP(fs.proc.Path("net/tcp6"))
37+
return NewNetTCP(fs.proc.Path("net/tcp6"))
3838
}
3939

4040
// NetTCPSummary returns already computed statistics like the total queue lengths
@@ -51,8 +51,8 @@ func (fs FS) NetTCP6Summary() (*NetTCPSummary, error) {
5151
return newNetTCPSummary(fs.proc.Path("net/tcp6"))
5252
}
5353

54-
// newNetTCP creates a new NetTCP{,6} from the contents of the given file.
55-
func newNetTCP(file string) (NetTCP, error) {
54+
// NewNetTCP creates a new NetTCP{,6} from the contents of the given file.
55+
func NewNetTCP(file string) (NetTCP, error) {
5656
n, err := newNetIPSocket(file)
5757
n1 := NetTCP(n)
5858
return n1, err

net_tcp_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func Test_newNetTCP(t *testing.T) {
115115
}
116116
for _, tt := range tests {
117117
t.Run(tt.name, func(t *testing.T) {
118-
got, err := newNetTCP(tt.file)
118+
got, err := NewNetTCP(tt.file)
119119
if (err != nil) != tt.wantErr {
120120
t.Errorf("newNetTCP() error = %v, wantErr %v", err, tt.wantErr)
121121
return

net_udp.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ type (
2626
// NetUDP returns the IPv4 kernel/networking statistics for UDP datagrams
2727
// read from /proc/net/udp.
2828
func (fs FS) NetUDP() (NetUDP, error) {
29-
return newNetUDP(fs.proc.Path("net/udp"))
29+
return NewNetUDP(fs.proc.Path("net/udp"))
3030
}
3131

3232
// NetUDP6 returns the IPv6 kernel/networking statistics for UDP datagrams
3333
// read from /proc/net/udp6.
3434
func (fs FS) NetUDP6() (NetUDP, error) {
35-
return newNetUDP(fs.proc.Path("net/udp6"))
35+
return NewNetUDP(fs.proc.Path("net/udp6"))
3636
}
3737

3838
// NetUDPSummary returns already computed statistics like the total queue lengths
@@ -47,8 +47,8 @@ func (fs FS) NetUDP6Summary() (*NetUDPSummary, error) {
4747
return newNetUDPSummary(fs.proc.Path("net/udp6"))
4848
}
4949

50-
// newNetUDP creates a new NetUDP{,6} from the contents of the given file.
51-
func newNetUDP(file string) (NetUDP, error) {
50+
// NewNetUDP creates a new NetUDP{,6} from the contents of the given file.
51+
func NewNetUDP(file string) (NetUDP, error) {
5252
n, err := newNetIPSocket(file)
5353
n1 := NetUDP(n)
5454
return n1, err

net_udp_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func Test_newNetUDP(t *testing.T) {
120120
}
121121
for _, tt := range tests {
122122
t.Run(tt.name, func(t *testing.T) {
123-
got, err := newNetUDP(tt.file)
123+
got, err := NewNetUDP(tt.file)
124124
if (err != nil) != tt.wantErr {
125125
t.Errorf("newNetUDP() error = %v, wantErr %v", err, tt.wantErr)
126126
return

net_wireless.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"strconv"
2222
"strings"
2323

24-
"github.com/prometheus/procfs/internal/util"
24+
"github.com/kubeshark/procfs/internal/util"
2525
)
2626

2727
// Wireless models the content of /proc/net/wireless.

nfs/nfs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"os"
2020
"strings"
2121

22-
"github.com/prometheus/procfs/internal/fs"
22+
"github.com/kubeshark/procfs/internal/fs"
2323
)
2424

2525
// ReplyCache models the "rc" line.

nfs/parse_nfs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"io"
2020
"strings"
2121

22-
"github.com/prometheus/procfs/internal/util"
22+
"github.com/kubeshark/procfs/internal/util"
2323
)
2424

2525
// ParseClientRPCStats returns stats read from /proc/net/rpc/nfs.

nfs/parse_nfs_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"strings"
1919
"testing"
2020

21-
"github.com/prometheus/procfs/nfs"
21+
"github.com/kubeshark/procfs/nfs"
2222
)
2323

2424
func TestNewNFSClientRPCStats(t *testing.T) {

nfs/parse_nfsd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"io"
2020
"strings"
2121

22-
"github.com/prometheus/procfs/internal/util"
22+
"github.com/kubeshark/procfs/internal/util"
2323
)
2424

2525
// ParseServerRPCStats returns stats read from /proc/net/rpc/nfsd.

nfs/parse_nfsd_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"strings"
1919
"testing"
2020

21-
"github.com/prometheus/procfs/nfs"
21+
"github.com/kubeshark/procfs/nfs"
2222
)
2323

2424
func TestNewNFSdServerRPCStats(t *testing.T) {

proc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"strconv"
2323
"strings"
2424

25-
"github.com/prometheus/procfs/internal/util"
25+
"github.com/kubeshark/procfs/internal/util"
2626
)
2727

2828
// Proc provides information about a running process.

0 commit comments

Comments
 (0)