forked from Silverfish/proton-bridge
Other: Only listen on localhost and add send test
We should only listen on constants.Host when serving IMAP and SMTP. This change fixes that. It also adds a test that we can send over SMTP and receive over IMAP.
This commit is contained in:
@ -487,7 +487,7 @@ func loadTLSConfig(vault *vault.Vault) (*tls.Config, error) {
|
||||
|
||||
func newListener(port int, useTLS bool, tlsConfig *tls.Config) (net.Listener, error) {
|
||||
if useTLS {
|
||||
tlsListener, err := tls.Listen("tcp", fmt.Sprintf(":%v", port), tlsConfig)
|
||||
tlsListener, err := tls.Listen("tcp", fmt.Sprintf("%v:%v", constants.Host, port), tlsConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -495,7 +495,7 @@ func newListener(port int, useTLS bool, tlsConfig *tls.Config) (net.Listener, er
|
||||
return tlsListener, nil
|
||||
}
|
||||
|
||||
netListener, err := net.Listen("tcp", fmt.Sprintf(":%v", port))
|
||||
netListener, err := net.Listen("tcp", fmt.Sprintf("%v:%v", constants.Host, port))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user