Browse Source

Cleanup

master
Wijnand 3 years ago
parent
commit
fba5073dd4
2 changed files with 7 additions and 37 deletions
  1. +7
    -7
      cmd/filter-rbl/main.go
  2. +0
    -30
      filter.go

+ 7
- 7
cmd/filter-rbl/main.go View File

@ -85,7 +85,7 @@ func onConnect(s *opensmtpd.Session, query *opensmtpd.ConnectQuery) error {
var (
result string
lsited bool
listed bool
host = reverse(ip)
err error
)
@ -146,16 +146,16 @@ func main() {
debugf("ignore: %s\n", ipnet)
}
f := new(opensmtpd.Filter)
f.OnConnect(onConnect)
f.OnDATA(onDATA)
filter := &opensmtpd.Filter{
Connect: onConnect,
DATA: onDATA,
}
if err = f.Register(); err != nil {
if err = filter.Register(); err != nil {
log.Fatalln(err)
}
if err = f.Serve(); err != nil {
if err = filter.Serve(); err != nil {
log.Fatalln(err)
}
}

+ 0
- 30
filter.go View File

@ -186,36 +186,6 @@ type Filter struct {
session *lru.Cache
}
func (f *Filter) OnConnect(fn func(*Session, *ConnectQuery) error) {
f.Connect = fn
f.hooks |= hookConnect
}
func (f *Filter) OnHELO(fn func(*Session, string) error) {
f.HELO = fn
f.hooks |= hookHELO
}
func (f *Filter) OnMAIL(fn func(*Session, string, string) error) {
f.MAIL = fn
f.hooks |= hookMAIL
}
func (f *Filter) OnRCPT(fn func(*Session, string, string) error) {
f.RCPT = fn
f.hooks |= hookRCPT
}
func (f *Filter) OnDATA(fn func(*Session) error) {
f.DATA = fn
f.hooks |= hookDATA
}
func (f *Filter) OnDataLine(fn func(*Session, string) error) {
f.DataLine = fn
f.hooks |= hookDataLine
}
// Register our filter with OpenSMTPD
func (f *Filter) Register() error {
var err error


Loading…
Cancel
Save