Skip to content

Commit 21f872f

Browse files
committed
discovery: strip extraneous comments outside MOLS change scope
1 parent 470e32e commit 21f872f

12 files changed

Lines changed: 0 additions & 86 deletions

File tree

portal/discovery/refresher.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ const (
2525
maxConcurrentOverlayDial = 8
2626
)
2727

28-
// OverlayRuntime defines the interface for relay discovery and overlay peer synchronization.
2928
type OverlayRuntime interface {
3029
DiscoverRelay(context.Context, types.RelayDescriptor) (types.DiscoveryResponse, error)
3130
Sync([]types.RelayDescriptor) error
3231
}
3332

34-
// Refresher periodically polls relay discovery endpoints and updates the relay set.
3533
type Refresher struct {
3634
relaySet *RelaySet
3735
httpClient *http.Client
@@ -41,7 +39,6 @@ type Refresher struct {
4139
lastAnnounceMu sync.Mutex
4240
}
4341

44-
// NewRefresher creates a new Refresher for the given relay set and overlay runtime.
4542
func NewRefresher(relaySet *RelaySet, overlay OverlayRuntime) *Refresher {
4643
return &Refresher{
4744
relaySet: relaySet,
@@ -278,7 +275,6 @@ func (r *Refresher) refreshOverlay(ctx context.Context) error {
278275
return nil
279276
}
280277

281-
// parallel executes fn concurrently for each item with a concurrency limit, returning the first error encountered.
282278
func parallel[T any](items []T, limit int, fn func(T) error) error {
283279
var wg sync.WaitGroup
284280
sem := make(chan struct{}, limit)

portal/discovery/relayset.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ const (
6767
upsertIgnored
6868
)
6969

70-
// NewRelaySet creates a new RelaySet initialized with the given bootstrap relay URLs.
7170
func NewRelaySet(bootstrapRelayURLs []string) *RelaySet {
7271
set := &RelaySet{
7372
relays: make(map[string]RelayState),
@@ -392,13 +391,11 @@ func (s *RelaySet) ConfirmedRelays() []RelayState {
392391
return selectConfirmed(s.currentRelayStates(time.Now().UTC()))
393392
}
394393

395-
// Route represents a planned relay path with optional multi-hop routing.
396394
type Route struct {
397395
path []string
398396
explicit bool
399397
}
400398

401-
// NewRoute creates a new Route with the given path and explicit flag.
402399
func NewRoute(path []string, explicit bool) Route {
403400
return Route{
404401
path: append([]string(nil), path...),

portal/discovery/relaystate.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ const (
6161
RelayVerified
6262
)
6363

64-
// PercentileTracker tracks RTT samples and computes percentiles for relay latency analysis.
6564
type PercentileTracker struct {
6665
samples []float64
6766
}
@@ -85,7 +84,6 @@ func (pt *PercentileTracker) Get(p float64) time.Duration {
8584
return time.Duration(val)
8685
}
8786

88-
// RelayState holds runtime telemetry and eligibility state for a single relay.
8987
type RelayState struct {
9088
Descriptor types.RelayDescriptor
9189
Bootstrap bool
@@ -147,7 +145,6 @@ func (state RelayState) effectiveRTT() time.Duration {
147145
return rtt
148146
}
149147

150-
// fixedLoad converts a floating-point load factor to a fixed-point integer scaled by relayMetricScale.
151148
func fixedLoad(load float64) uint32 {
152149
if load <= 0 {
153150
return 0
@@ -186,7 +183,6 @@ func (state *RelayState) UpdateLoad(loadFixed uint32) {
186183
state.StoreLoadFactor(loadFixed)
187184
}
188185

189-
// inheritAdaptiveTelemetry copies adaptive telemetry state from an existing relay entry to preserve load and RTT history.
190186
func (state *RelayState) inheritAdaptiveTelemetry(existing RelayState) {
191187
load := atomic.LoadUint32(&existing.loadFixed)
192188
if load == 0 && existing.LoadFactor != 0 {
@@ -260,7 +256,6 @@ func absDuration(value time.Duration) time.Duration {
260256
return value
261257
}
262258

263-
// newRelayState creates a minimal RelayState with the given relay URL.
264259
func newRelayState(relayURL string) RelayState {
265260
return RelayState{
266261
Descriptor: types.RelayDescriptor{
@@ -269,7 +264,6 @@ func newRelayState(relayURL string) RelayState {
269264
}
270265
}
271266

272-
// hasObservedDescriptor reports whether a relay descriptor has been observed via discovery.
273267
func (state RelayState) hasObservedDescriptor() bool {
274268
return !state.LastSeenAt.IsZero()
275269
}
@@ -287,7 +281,6 @@ func (state RelayState) eligibleForMultiHop(routeState RouteState, now time.Time
287281
(state.nextDiscoveryRefreshAt.IsZero() || !state.nextDiscoveryRefreshAt.After(now))
288282
}
289283

290-
// RouteState describes the client's routing requirements for relay selection.
291284
type RouteState struct {
292285
ExplicitRelayURLs []string
293286
// ActiveRelayURLs holds currently active connected relay URLs to enable
@@ -308,7 +301,6 @@ type RouteState struct {
308301
SelectionEpoch uint64
309302
}
310303

311-
// supportsRequiredTransports reports whether the relay supports the UDP and TCP transports required by the route.
312304
func (state RelayState) supportsRequiredTransports(routeState RouteState, now time.Time) bool {
313305
if !state.hasObservedDescriptor() || !state.Descriptor.ExpiresAt.After(now) {
314306
return true

sdk/expose.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ type Exposure struct {
4040
connSeq atomic.Uint64
4141
}
4242

43-
// ExposeConfig holds the configuration for exposing a local service through the portal tunnel.
4443
type ExposeConfig struct {
4544
RelayURLs []string
4645
Discovery bool

sdk/http.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/gosuda/portal-tunnel/v2/utils"
2121
)
2222

23-
// RunHTTP serves HTTP traffic from the relay listener or local address using the provided handler.
2423
func RunHTTP(ctx context.Context, relayListener net.Listener, handler http.Handler, localAddr string) error {
2524
if relayListener == nil && localAddr == "" {
2625
return errors.New("relay listener or local address is required")

sdk/mitm.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const (
3232
defaultMITMProbeTimeout = 30 * time.Second
3333
)
3434

35-
// MITMProbeReport contains the results of a man-in-the-middle detection probe.
3635
type MITMProbeReport struct {
3736
RelayURL string
3837
PublicURL string

sdk/proxy.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/gosuda/portal-tunnel/v2/types"
1717
)
1818

19-
// ProxyExposure runs the TCP/UDP proxy for the given exposure until the context is canceled.
2019
func ProxyExposure(ctx context.Context, exposure *Exposure) error {
2120
defer exposure.Close()
2221
if len(exposure.ActiveRelayURLs()) == 0 {

types/agent.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package types
22

3-
// AgentStatusResponse contains the current status of the portal-tunnel agent daemon.
43
type AgentStatusResponse struct {
54
ConfigPath string `json:"config_path,omitempty"`
65
ControlAddr string `json:"control_addr"`
76
WalletAddress string `json:"wallet_address,omitempty"`
87
Tunnels []AgentTunnelStatus `json:"tunnels,omitempty"`
98
}
109

11-
// AgentTunnelStatus represents the runtime state of a single managed tunnel.
1210
type AgentTunnelStatus struct {
1311
ID string `json:"id"`
1412
Name string `json:"name,omitempty"`
@@ -30,15 +28,13 @@ type AgentTunnelStatus struct {
3028
Relays []AgentRelayStatus `json:"relays,omitempty"`
3129
}
3230

33-
// AgentHTTPRoute defines an HTTP routing rule for paid or public endpoints.
3431
type AgentHTTPRoute struct {
3532
Prefix string `json:"prefix"`
3633
Upstream string `json:"upstream"`
3734
Methods []string `json:"methods,omitempty"`
3835
Amount string `json:"amount,omitempty"`
3936
}
4037

41-
// AgentRelayStatus reports the connection state and capabilities of a relay.
4238
type AgentRelayStatus struct {
4339
RelayURL string `json:"relay_url"`
4440
PublicURL string `json:"public_url,omitempty"`
@@ -52,7 +48,6 @@ type AgentRelayStatus struct {
5248
SupportsTCP bool `json:"supports_tcp"`
5349
}
5450

55-
// AgentTunnelRequest describes a tunnel configuration submitted to the agent API.
5651
type AgentTunnelRequest struct {
5752
ID string `json:"id"`
5853
Name string `json:"name,omitempty"`
@@ -69,17 +64,14 @@ type AgentTunnelRequest struct {
6964
X402Endpoints []string `json:"x402_endpoints,omitempty"`
7065
}
7166

72-
// AgentRelayRequest identifies a relay by URL for add/remove operations.
7367
type AgentRelayRequest struct {
7468
RelayURL string `json:"relay_url"`
7569
}
7670

77-
// AgentMultiHopRequest configures explicit multi-hop relay paths.
7871
type AgentMultiHopRequest struct {
7972
Relays []string `json:"relays"`
8073
}
8174

82-
// AgentTunnelUpdateRequest applies partial updates to a running tunnel's configuration.
8375
type AgentTunnelUpdateRequest struct {
8476
MaxActiveRelays *int `json:"max_active_relays,omitempty"`
8577
Metadata *AgentMetadataRequest `json:"metadata,omitempty"`
@@ -90,7 +82,6 @@ func (r AgentTunnelUpdateRequest) Empty() bool {
9082
(r.Metadata == nil || r.Metadata.Empty())
9183
}
9284

93-
// AgentMetadataRequest holds partial metadata updates for a tunnel.
9485
type AgentMetadataRequest struct {
9586
Description *string `json:"description,omitempty"`
9687
Owner *string `json:"owner,omitempty"`

0 commit comments

Comments
 (0)