Skip to content

HAProxy SMTP proxy-protocol handler for extending golang smtpd library

License

Notifications You must be signed in to change notification settings

mailsac/smtpd-proxyhandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smtpd-proxyhandler

HAProxy SMTP proxy-protocol handler for extending the golang mailsac mailproto/smtpd fork library.

https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt

v1 protocol is supported. v2 protocol is not supported (TBD).

This package allows an upstream proxy to modify the end user IP address on an SMTP connection.

Usage

import (
    proxyhandler "github.com/mailsac/smtpd-proxyhandler"
    "github.com/mailsac/smtpd"
)

server := smtpd.NewServer(messageHandler)

// ... set up server, then add upstream proxy IP addresses
allowProxyIPs := []string{"10.0.0.1", "10.0.0.2"}
handler := proxyhandler.ProxyHandlerV1{ TrustIPs: allowProxyIPs }
server.Extend("PROXY", &handler)

About

HAProxy SMTP proxy-protocol handler for extending golang smtpd library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages