Skip to content

Commit

Permalink
rate_limiter: impl io.Closer
Browse files Browse the repository at this point in the history
  • Loading branch information
IrineSistiana committed Sep 26, 2023
1 parent 18842d0 commit ea7b261
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugin/executable/rate_limiter/rate_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package rate_limiter

import (
"context"
"io"

"github.com/IrineSistiana/mosdns/v5/coremain"
"github.com/IrineSistiana/mosdns/v5/pkg/query_context"
Expand Down Expand Up @@ -52,6 +53,7 @@ func (args *Args) init() {
}

var _ sequence.Executable = (*RateLimiter)(nil)
var _ io.Closer = (*RateLimiter)(nil)

type RateLimiter struct {
l rate_limiter.RateLimiter
Expand All @@ -77,6 +79,10 @@ func (s *RateLimiter) Exec(ctx context.Context, qCtx *query_context.Context) err
return nil
}

func (s *RateLimiter) Close() error {
return s.l.Close()
}

func refuse(q *dns.Msg) *dns.Msg {
r := new(dns.Msg)
r.SetReply(q)
Expand Down

0 comments on commit ea7b261

Please sign in to comment.