Skip to content

Commit

Permalink
fixup! feat: Make net_(tcp|udp) read limit configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
rexagod committed May 13, 2024
1 parent 7409825 commit 48bbe38
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ require (
github.com/google/go-cmp v0.6.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.19.0
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
4 changes: 1 addition & 3 deletions net_ip_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"os"
"strconv"
"strings"

"k8s.io/utils/ptr"
)

var (
Expand All @@ -33,7 +31,7 @@ var (
// In theory, the number of available sockets is 65535 (2^16 - 1) per IP.
// With e.g. 150 Byte per line and the maximum number of 65535,
// the reader needs to handle 150 Byte * 65535 =~ 10 MB for a single IP.
defaultReadLimit = ptr.To(4294967296) // Byte -> 4 GiB
defaultReadLimit = ptrTo(4294967296) // Byte -> 4 GiB
)

// This contains generic data structures for both udp and tcp sockets.
Expand Down
6 changes: 6 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package procfs

// To returns a pointer to the given value.
func ptrTo[T any](v T) *T {
return &v
}

0 comments on commit 48bbe38

Please sign in to comment.