mailhog / MailHog

Web and API based SMTP testing
MIT License
14.07k stars 1.07k forks source link

ipv6 #81

Open kusmierz opened 8 years ago

kusmierz commented 8 years ago

I'm trying to run MailHog without docker, but it listening only on tcp6, see below.

root@x:~# ./MailHog_linux_amd64 &
[1] 20110
2016/03/10 21:36:06 Using in-memory storage
2016/03/10 21:36:06 [SMTP] Binding to address: 0.0.0.0:1025
[HTTP] Binding to address: 0.0.0.0:8025
Creating API v1
Creating API v2

root@x:~# netstat -lanp | grep 025
tcp6       0      0 :::8025                 :::*                    LISTEN      20110/MailHog_linux
tcp6       0      0 :::1025                 :::*                    LISTEN      20110/MailHog_linux
root@x:~# 
ian-kent commented 8 years ago

Hi @kusmierz

I'm not able to reproduce it on a mac - does MailHog still work as expected? I'm wondering if it's related to this: https://groups.google.com/forum/#!topic/golang-nuts/F5HE7Eqb6iM

It looks like I could force it to use IPv4, but that would complicate also supporting IPv6

kusmierz commented 8 years ago

It was on Ubuntu. But it seems each and every linuxes works the same. Try CoreOS on VM or DigitalOcean.

core@digitalocean ~ $ wget 'https://github.com/mailhog/MailHog/releases/download/v0.1.9/MailHog_linux_amd64'
--2016-03-14 09:28:20--  https://github.com/mailhog/MailHog/releases/download/v0.1.9/MailHog_linux_amd64
Resolving github.com... 192.30.252.131
(...)
Resolving github-cloud.s3.amazonaws.com... 54.231.114.138
Connecting to github-cloud.s3.amazonaws.com|54.231.114.138|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12440776 (12M) [application/octet-stream]
Saving to: 'MailHog_linux_amd64'

MailHog_linux_amd64             100%[========================================================>]  11.86M  5.63MB/s   in 2.1s   

2016-03-14 09:28:23 (5.63 MB/s) - 'MailHog_linux_amd64' saved [12440776/12440776]

core@digitalocean ~ $ chmod a+x MailHog_linux_amd64 
core@digitalocean ~ $ ./MailHog_linux_amd64 &
[1] 5264
2016/03/14 09:28:34 Using in-memory storage
2016/03/14 09:28:34 [SMTP] Binding to address: 0.0.0.0:1025
[HTTP] Binding to address: 0.0.0.0:8025
2016/03/14 09:28:34 Serving under http://0.0.0.0:8025/
Creating API v1 with WebPath: 
Creating API v2 with WebPath: 

core@digitalocean ~ $ sudo netstat -lanp | grep 25
tcp6       0      0 :::8025                 :::*                    LISTEN      5264/./MailHog_linu 
tcp6       0      0 :::1025                 :::*                    LISTEN      5264/./MailHog_linu 
core@digitalocean ~ $
kusmierz commented 8 years ago

See also docker/docker#13914.

ian-kent commented 8 years ago

Thanks @kusmierz

I've tested it using CoreOS in a VM, and get the same output as you. But it still works as expected, e.g. using curl -4 http://localhost:8025, which suggests the ports are actually open.

Interestingly, but maybe unrelated - if I follow this guide to remove ipv6 addresses, restart MailHog, then run sudo netstat -lanp | grep 25 again, it still lists only tcp6 ports

Does this bug cause MailHog to break in any way, or does it only affect the output of netstat?

kusmierz commented 8 years ago

Hm, it's really weird, curl -4 http://localhost:8025 returns output as expected and it's really there.

I'd rather do not turning off ipv6...

Nevertheless, it seems it works very well...