Skip to content

Commit

Permalink
fixup! fixup! feat: Make net_(tcp|udp) read limit configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
  • Loading branch information
rexagod committed May 13, 2024
1 parent d7eefc8 commit f5d2ec4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions utils.go → internal/util/ptr.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package procfs
package util

// To returns a pointer to the given value.
func ptrTo[T any](v T) *T {
// PtrTo returns a pointer to the given value.
func PtrTo[T any](v T) *T {
return &v
}
3 changes: 2 additions & 1 deletion net_ip_socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"bufio"
"encoding/hex"
"fmt"
"github.com/prometheus/procfs/internal/util"
"io"
"net"
"os"
Expand All @@ -31,7 +32,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 = ptrTo(4294967296) // Byte -> 4 GiB
defaultReadLimit = util.PtrTo(4294967296) // Byte -> 4 GiB
)

// This contains generic data structures for both udp and tcp sockets.
Expand Down

0 comments on commit f5d2ec4

Please sign in to comment.