MCPcopy Create free account
hub / github.com/foxcpp/maddy / CheckConnection

Method CheckConnection

internal/check/dnsbl/dnsbl.go:443–462  ·  view source on GitHub ↗

CheckConnection implements module.EarlyCheck.

(ctx context.Context, state *module.ConnState)

Source from the content-addressed store, hash-verified

441
442// CheckConnection implements module.EarlyCheck.
443func (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
464type state struct {
465 bl *DNSBL

Callers

nothing calls this directly

Calls 3

checkListsMethod · 0.95
MsgMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected