aboutsummaryrefslogtreecommitdiff
path: root/net/cloudflared
diff options
context:
space:
mode:
Diffstat (limited to 'net/cloudflared')
-rw-r--r--net/cloudflared/Makefile4
-rw-r--r--net/cloudflared/distinfo6
-rw-r--r--net/cloudflared/files/patch-diagnostic_network_collector__unix.go8
-rw-r--r--net/cloudflared/files/patch-diagnostic_system__collector__freebsd.go173
4 files changed, 186 insertions, 5 deletions
diff --git a/net/cloudflared/Makefile b/net/cloudflared/Makefile
index 8b2fd0567e05..9bb6ded10f71 100644
--- a/net/cloudflared/Makefile
+++ b/net/cloudflared/Makefile
@@ -1,5 +1,5 @@
PORTNAME= cloudflared
-DISTVERSION= 2024.11.1
+DISTVERSION= 2025.8.0
CATEGORIES= net www
MAINTAINER= egypcio@FreeBSD.org
@@ -11,7 +11,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
RUN_DEPENDS= ca_root_nss>=0:security/ca_root_nss
-USES= cpe go:1.22,modules
+USES= cpe go:modules
USE_RC_SUBR= ${PORTNAME}
USE_GITHUB= yes
GH_ACCOUNT= cloudflare
diff --git a/net/cloudflared/distinfo b/net/cloudflared/distinfo
index 6d5425bcdc5d..05a26826977f 100644
--- a/net/cloudflared/distinfo
+++ b/net/cloudflared/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1744204985
-SHA256 (cloudflare-cloudflared-2024.11.1_GH0.tar.gz) = 1bf729c225701f6864b31bb6c251293caa06f9f1a6e671f3326dd20c3c9719ff
-SIZE (cloudflare-cloudflared-2024.11.1_GH0.tar.gz) = 7000271
+TIMESTAMP = 1755055501
+SHA256 (cloudflare-cloudflared-2025.8.0_GH0.tar.gz) = a57411cdfc729b9f867ff42e4c365eeb31d0fdc5f763f7d813adf6f44a37ef35
+SIZE (cloudflare-cloudflared-2025.8.0_GH0.tar.gz) = 7220411
diff --git a/net/cloudflared/files/patch-diagnostic_network_collector__unix.go b/net/cloudflared/files/patch-diagnostic_network_collector__unix.go
new file mode 100644
index 000000000000..8ae12665a122
--- /dev/null
+++ b/net/cloudflared/files/patch-diagnostic_network_collector__unix.go
@@ -0,0 +1,8 @@
+--- diagnostic/network/collector_unix.go.orig 2024-01-01 00:00:00 UTC
++++ diagnostic/network/collector_unix.go
+@@ -1,4 +1,4 @@
+-//go:build darwin || linux
++//go:build darwin || linux || freebsd
+
+ package diagnostic
+
diff --git a/net/cloudflared/files/patch-diagnostic_system__collector__freebsd.go b/net/cloudflared/files/patch-diagnostic_system__collector__freebsd.go
new file mode 100644
index 000000000000..f60a9fe1db01
--- /dev/null
+++ b/net/cloudflared/files/patch-diagnostic_system__collector__freebsd.go
@@ -0,0 +1,173 @@
+--- /dev/null 2024-01-01 00:00:00 UTC
++++ diagnostic/system_collector_freebsd.go
+@@ -0,0 +1,170 @@
++//go:build freebsd
++
++package diagnostic
++
++import (
++ "context"
++ "fmt"
++ "os/exec"
++ "runtime"
++ "strconv"
++ "strings"
++)
++
++type SystemCollectorImpl struct {
++ version string
++}
++
++func NewSystemCollectorImpl(
++ version string,
++) *SystemCollectorImpl {
++ return &SystemCollectorImpl{
++ version,
++ }
++}
++
++func (collector *SystemCollectorImpl) Collect(ctx context.Context) (*SystemInformation, error) {
++ memoryInfo, memoryInfoRaw, memoryInfoErr := collectMemoryInformation(ctx)
++ fdInfo, fdInfoRaw, fdInfoErr := collectFileDescriptorInformation(ctx)
++ disks, disksRaw, diskErr := collectDiskVolumeInformationUnix(ctx)
++ osInfo, osInfoRaw, osInfoErr := collectOSInformationUnix(ctx)
++
++ var memoryMaximum, memoryCurrent, fileDescriptorMaximum, fileDescriptorCurrent uint64
++ var osSystem, name, osVersion, osRelease, architecture string
++ gerror := SystemInformationGeneralError{}
++
++ if memoryInfoErr != nil {
++ gerror.MemoryInformationError = SystemInformationError{
++ Err: memoryInfoErr,
++ RawInfo: memoryInfoRaw,
++ }
++ } else {
++ memoryMaximum = memoryInfo.MemoryMaximum
++ memoryCurrent = memoryInfo.MemoryCurrent
++ }
++
++ if fdInfoErr != nil {
++ gerror.FileDescriptorsInformationError = SystemInformationError{
++ Err: fdInfoErr,
++ RawInfo: fdInfoRaw,
++ }
++ } else {
++ fileDescriptorMaximum = fdInfo.FileDescriptorMaximum
++ fileDescriptorCurrent = fdInfo.FileDescriptorCurrent
++ }
++
++ if diskErr != nil {
++ gerror.DiskVolumeInformationError = SystemInformationError{
++ Err: diskErr,
++ RawInfo: disksRaw,
++ }
++ }
++
++ if osInfoErr != nil {
++ gerror.OperatingSystemInformationError = SystemInformationError{
++ Err: osInfoErr,
++ RawInfo: osInfoRaw,
++ }
++ } else {
++ osSystem = osInfo.OsSystem
++ name = osInfo.Name
++ osVersion = osInfo.OsVersion
++ osRelease = osInfo.OsRelease
++ architecture = osInfo.Architecture
++ }
++
++ cloudflaredVersion := collector.version
++ info := NewSystemInformation(
++ memoryMaximum,
++ memoryCurrent,
++ fileDescriptorMaximum,
++ fileDescriptorCurrent,
++ osSystem,
++ name,
++ osVersion,
++ osRelease,
++ architecture,
++ cloudflaredVersion,
++ runtime.Version(),
++ runtime.GOARCH,
++ disks,
++ )
++
++ return info, gerror
++}
++
++func collectMemoryInformation(ctx context.Context) (*MemoryInformation, string, error) {
++ // Use sysctl to get memory information on FreeBSD
++ command := exec.CommandContext(ctx, "sysctl", "-n", "hw.physmem", "vm.stats.vm.v_free_count", "hw.pagesize")
++
++ stdout, err := command.Output()
++ if err != nil {
++ return nil, "", fmt.Errorf("error retrieving output from command '%s': %w", command.String(), err)
++ }
++
++ output := string(stdout)
++ lines := strings.Split(strings.TrimSpace(output), "\n")
++
++ if len(lines) < 3 {
++ return nil, output, fmt.Errorf("unexpected sysctl output format")
++ }
++
++ physmem, err := strconv.ParseUint(lines[0], 10, 64)
++ if err != nil {
++ return nil, output, fmt.Errorf("error parsing physmem: %w", err)
++ }
++
++ freePages, err := strconv.ParseUint(lines[1], 10, 64)
++ if err != nil {
++ return nil, output, fmt.Errorf("error parsing free pages: %w", err)
++ }
++
++ pageSize, err := strconv.ParseUint(lines[2], 10, 64)
++ if err != nil {
++ return nil, output, fmt.Errorf("error parsing page size: %w", err)
++ }
++
++ memoryMaximum := physmem / 1024 // Convert to KB
++ memoryCurrent := (freePages * pageSize) / 1024 // Convert to KB
++
++ memoryInfo := &MemoryInformation{
++ MemoryMaximum: memoryMaximum,
++ MemoryCurrent: memoryCurrent,
++ }
++
++ return memoryInfo, output, nil
++}
++
++func collectFileDescriptorInformation(ctx context.Context) (*FileDescriptorInformation, string, error) {
++ // Use sysctl to get file descriptor limits on FreeBSD
++ command := exec.CommandContext(ctx, "sysctl", "-n", "kern.maxfiles", "kern.openfiles")
++
++ stdout, err := command.Output()
++ if err != nil {
++ return nil, "", fmt.Errorf("error retrieving output from command '%s': %w", command.String(), err)
++ }
++
++ output := string(stdout)
++ lines := strings.Split(strings.TrimSpace(output), "\n")
++
++ if len(lines) < 2 {
++ return nil, output, fmt.Errorf("unexpected sysctl output format")
++ }
++
++ maxFiles, err := strconv.ParseUint(lines[0], 10, 64)
++ if err != nil {
++ return nil, output, fmt.Errorf("error parsing maxfiles: %w", err)
++ }
++
++ openFiles, err := strconv.ParseUint(lines[1], 10, 64)
++ if err != nil {
++ return nil, output, fmt.Errorf("error parsing openfiles: %w", err)
++ }
++
++ fdInfo := &FileDescriptorInformation{
++ FileDescriptorMaximum: maxFiles,
++ FileDescriptorCurrent: openFiles,
++ }
++
++ return fdInfo, output, nil
++}