CheckConnection implements module.EarlyCheck.
(ctx context.Context, state *module.ConnState)
| 441 | |
| 442 | // CheckConnection implements module.EarlyCheck. |
| 443 | func (bl *DNSBL) CheckConnection(ctx context.Context, state *module.ConnState) error { |
| 444 | defer trace.StartRegion(ctx, "dnsbl/CheckConnection (Early)").End() |
| 445 | |
| 446 | ip, ok := state.RemoteAddr.(*net.TCPAddr) |
| 447 | if !ok { |
| 448 | bl.log.Msg("non-TCP/IP source", |
| 449 | "src_addr", state.RemoteAddr, |
| 450 | "src_host", state.Hostname) |
| 451 | return nil |
| 452 | } |
| 453 | |
| 454 | result := bl.checkLists(ctx, ip.IP, state.Hostname, "") |
| 455 | if result.Reject && bl.checkEarly { |
| 456 | return result.Reason |
| 457 | } |
| 458 | |
| 459 | state.ModData.Set(bl, true, result) |
| 460 | |
| 461 | return nil |
| 462 | } |
| 463 | |
| 464 | type state struct { |
| 465 | bl *DNSBL |
nothing calls this directly
no test coverage detected