Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit e704b04

Browse files
committed
refactor: flatten RelayService limits
this simplifies consumer code and removes nil footgun
1 parent 8e9dc6a commit e704b04

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

swarm.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ type RelayService struct {
4242
// Enables the limited relay (circuit v2 relay).
4343
Enabled Flag `json:",omitempty"`
4444

45-
// Limit is the (optional) relayed connection limits.
46-
Limit *RelayLimit `json:",omitempty"`
45+
// ConnectionDurationLimit is the time limit before resetting a relayed connection.
46+
ConnectionDurationLimit *OptionalDuration `json:",omitempty"`
47+
// ConnectionDataLimit is the limit of data relayed (on each direction) before resetting the connection.
48+
ConnectionDataLimit *OptionalInteger `json:",omitempty"`
4749

4850
// ReservationTTL is the duration of a new (or refreshed reservation).
4951
ReservationTTL *OptionalDuration `json:",omitempty"`
@@ -63,14 +65,6 @@ type RelayService struct {
6365
MaxReservationsPerASN *OptionalInteger `json:",omitempty"`
6466
}
6567

66-
// RelayLimit are the per relayed connection resource limits.
67-
type RelayLimit struct {
68-
// Duration is the time limit before resetting a relayed connection.
69-
Duration *OptionalDuration `json:",omitempty"`
70-
// Data is the limit of data relayed (on each direction) before resetting the connection.
71-
Data *OptionalInteger `json:",omitempty"`
72-
}
73-
7468
type Transports struct {
7569
// Network specifies the base transports we'll use for dialing. To
7670
// listen on a transport, add the transport to your Addresses.Swarm.

0 commit comments

Comments
 (0)