summaryrefslogtreecommitdiffstats
path: root/cmd/relay/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/relay/main.go')
-rw-r--r--cmd/relay/main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/relay/main.go b/cmd/relay/main.go
index e4afec8..86a29cb 100644
--- a/cmd/relay/main.go
+++ b/cmd/relay/main.go
@@ -79,8 +79,9 @@ func main() {
79 streamInterceptors = append(streamInterceptors, auth.NostrStreamInterceptor(authOpts)) 79 streamInterceptors = append(streamInterceptors, auth.NostrStreamInterceptor(authOpts))
80 } 80 }
81 81
82 var limiter *ratelimit.Limiter
82 if cfg.RateLimit.Enabled { 83 if cfg.RateLimit.Enabled {
83 limiter := ratelimit.New(cfg.RateLimit.ToRateLimiter()) 84 limiter = ratelimit.New(cfg.RateLimit.ToRateLimiter())
84 unaryInterceptors = append(unaryInterceptors, ratelimit.UnaryInterceptor(limiter)) 85 unaryInterceptors = append(unaryInterceptors, ratelimit.UnaryInterceptor(limiter))
85 streamInterceptors = append(streamInterceptors, ratelimit.StreamInterceptor(limiter)) 86 streamInterceptors = append(streamInterceptors, ratelimit.StreamInterceptor(limiter))
86 } 87 }
@@ -125,6 +126,10 @@ func main() {
125 }) 126 })
126 } 127 }
127 128
129 if limiter != nil {
130 wsHandler.SetRateLimiter(limiter)
131 }
132
128 var grpcDisplay, httpDisplay, wsDisplay string 133 var grpcDisplay, httpDisplay, wsDisplay string
129 if cfg.Server.PublicURL != "" { 134 if cfg.Server.PublicURL != "" {
130 grpcDisplay = cfg.Server.PublicURL + ":443" 135 grpcDisplay = cfg.Server.PublicURL + ":443"