https://github.com/mailsac/smtpd-proxyhandler
HAProxy SMTP proxy-protocol handler for extending golang smtpd library
https://github.com/mailsac/smtpd-proxyhandler
smtp-proxy
Last synced: 5 months ago
JSON representation
HAProxy SMTP proxy-protocol handler for extending golang smtpd library
- Host: GitHub
- URL: https://github.com/mailsac/smtpd-proxyhandler
- Owner: mailsac
- License: mit
- Created: 2020-07-22T15:25:20.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-24T16:05:01.000Z (almost 4 years ago)
- Last Synced: 2024-06-19T15:17:26.846Z (about 2 years ago)
- Topics: smtp-proxy
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# smtpd-proxyhandler
HAProxy SMTP proxy-protocol handler for extending the golang [mailsac mailproto/smtpd fork](https://github.com/mailsac/smtpd) 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
```go
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)
```