decouple service from peer service limit setting for defaults
@@ -53,6 +53,8 @@ func SetDefaultServiceLimits(limiter *rcmgr.BasicLimiter) {
limiter.ServiceLimits[identify.ServiceName] = limiter.DefaultServiceLimits.
WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
WithStreamLimit(128, 128, 256) // max 256 streams -- symmetric
+ }
+ if _, ok := limiter.ServicePeerLimits[identify.ServiceName]; !ok {
limiter.ServicePeerLimits[identify.ServiceName] = peerSvcLimit(16, 16, 32)
}
// ping
@@ -60,6 +62,8 @@ func SetDefaultServiceLimits(limiter *rcmgr.BasicLimiter) {
limiter.ServiceLimits[ping.ServiceName] = limiter.DefaultServiceLimits.
WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
WithStreamLimit(128, 128, 128) // max 128 streams - asymmetric
+ }
+ if _, ok := limiter.ServicePeerLimits[ping.ServiceName]; !ok {
limiter.ServicePeerLimits[ping.ServiceName] = peerSvcLimit(2, 3, 4)
}
// autonat
@@ -67,6 +71,8 @@ func SetDefaultServiceLimits(limiter *rcmgr.BasicLimiter) {
limiter.ServiceLimits[autonat.ServiceName] = limiter.DefaultServiceLimits.
WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
WithStreamLimit(128, 128, 128) // max 128 streams - asymmetric
+ }
+ if _, ok := limiter.ServicePeerLimits[autonat.ServiceName]; !ok {
limiter.ServicePeerLimits[autonat.ServiceName] = peerSvcLimit(2, 2, 2)
}
// holepunch
@@ -74,6 +80,8 @@ func SetDefaultServiceLimits(limiter *rcmgr.BasicLimiter) {
limiter.ServiceLimits[holepunch.ServiceName] = limiter.DefaultServiceLimits.
WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
WithStreamLimit(128, 128, 256) // max 256 streams - symmetric
+ }
+ if _, ok := limiter.ServicePeerLimits[holepunch.ServiceName]; !ok {
limiter.ServicePeerLimits[autonat.ServiceName] = peerSvcLimit(2, 2, 2)
}
// relay/v1
@@ -81,6 +89,8 @@ func SetDefaultServiceLimits(limiter *rcmgr.BasicLimiter) {
limiter.ServiceLimits[circuitv1.ServiceName] = limiter.DefaultServiceLimits.
WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
WithStreamLimit(1024, 1024, 1024) // max 1024 streams - asymmetric
+ }
+ if _, ok := limiter.ServicePeerLimits[circuitv1.ServiceName]; !ok {
limiter.ServicePeerLimits[circuitv1.ServiceName] = peerSvcLimit(64, 64, 64)
}
// relay/v2
@@ -88,6 +98,8 @@ func SetDefaultServiceLimits(limiter *rcmgr.BasicLimiter) {
limiter.ServiceLimits[circuitv2.ServiceName] = limiter.DefaultServiceLimits.
WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
WithStreamLimit(1024, 1024, 1024) // max 1024 streams - asymmetric
+ }
+ if _, ok := limiter.ServicePeerLimits[circuitv2.ServiceName]; !ok {
limiter.ServicePeerLimits[circuitv2.ServiceName] = peerSvcLimit(64, 64, 64)
}
}
