diff --git a/BRIDGE_VERSION b/BRIDGE_VERSION index 557fefc..cf2dc0b 100644 --- a/BRIDGE_VERSION +++ b/BRIDGE_VERSION @@ -1 +1 @@ -v2.1.3 \ No newline at end of file +v2.2.0 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0ac3123..5a55bb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,11 @@ LABEL maintainer="Xiaonan Shen " EXPOSE 25/tcp EXPOSE 143/tcp +HEALTHCHECK --timeout=2s CMD nc -z 127.0.0.1 1025 && nc -z 127.0.0.1 1143 + # Install dependencies and protonmail bridge RUN apt-get update \ - && apt-get install -y --no-install-recommends socat pass libsecret-1-0 ca-certificates curl gosu \ + && apt-get install -y --no-install-recommends socat pass libsecret-1-0 ca-certificates curl gosu netcat \ && rm -rf /var/lib/apt/lists/* # Copy bash scripts diff --git a/http_rest_frontend/cli/frontend.go b/http_rest_frontend/cli/frontend.go index 53e5662..93aadad 100644 --- a/http_rest_frontend/cli/frontend.go +++ b/http_rest_frontend/cli/frontend.go @@ -112,8 +112,7 @@ func (f *frontendCLI) loginWithEnv() { func (f *frontendCLI) watchEvents() { errorCh := f.eventListener.ProvideChannel(events.ErrorEvent) credentialsErrorCh := f.eventListener.ProvideChannel(events.CredentialsErrorEvent) - internetOffCh := f.eventListener.ProvideChannel(events.InternetOffEvent) - internetOnCh := f.eventListener.ProvideChannel(events.InternetOnEvent) + internetConnChangedCh := f.eventListener.ProvideChannel(events.InternetConnChangedEvent) addressChangedCh := f.eventListener.ProvideChannel(events.AddressChangedEvent) addressChangedLogoutCh := f.eventListener.ProvideChannel(events.AddressChangedLogoutEvent) logoutCh := f.eventListener.ProvideChannel(events.LogoutEvent) @@ -121,13 +120,16 @@ func (f *frontendCLI) watchEvents() { for { select { case errorDetails := <-errorCh: - fmt.Println("Bridge failed:", errorDetails) + logrus.Error("Bridge failed:", errorDetails) case <-credentialsErrorCh: f.notifyCredentialsError() - case <-internetOffCh: - f.notifyInternetOff() - case <-internetOnCh: - f.notifyInternetOn() + case stat := <-internetConnChangedCh: + if stat == events.InternetOff { + f.notifyInternetOff() + } + if stat == events.InternetOn { + f.notifyInternetOn() + } case address := <-addressChangedCh: fmt.Printf("Address changed for %s. You may need to reconfigure your email client.", address) case address := <-addressChangedLogoutCh: