mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 12:54:01 +03:00
Add EventIPBlocklisted
This commit is contained in:
@@ -52,6 +52,16 @@ func (p *Proxy) Serve(listener net.Listener) error {
|
||||
return fmt.Errorf("cannot accept a new connection: %w", err)
|
||||
}
|
||||
|
||||
if addr := conn.RemoteAddr().(*net.TCPAddr).IP; p.ipBlocklist.Contains(addr) {
|
||||
conn.Close()
|
||||
p.eventStream.Send(p.ctx, EventIPBlocklisted{
|
||||
CreatedAt: time.Now(),
|
||||
RemoteIP: addr,
|
||||
})
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
err = p.workerPool.Invoke(conn)
|
||||
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user