2020-07-12 21:19:44 -04:00
|
|
|
package logging
|
2020-02-06 20:42:46 -05:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/kyokomi/emoji"
|
2020-07-26 12:07:06 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
2020-02-06 20:42:46 -05:00
|
|
|
)
|
|
|
|
|
|
2020-02-08 21:08:49 +00:00
|
|
|
// Splash returns the welcome spash message
|
2020-05-02 14:48:18 +00:00
|
|
|
func Splash(version, vcsRef, buildDate string) string {
|
2020-02-06 20:42:46 -05:00
|
|
|
lines := title()
|
|
|
|
|
lines = append(lines, "")
|
|
|
|
|
lines = append(lines, fmt.Sprintf("Running version %s built on %s (commit %s)", version, buildDate, vcsRef))
|
|
|
|
|
lines = append(lines, "")
|
2020-03-04 23:47:21 +00:00
|
|
|
lines = append(lines, announcement()...)
|
2020-02-06 20:42:46 -05:00
|
|
|
lines = append(lines, "")
|
|
|
|
|
lines = append(lines, links()...)
|
|
|
|
|
return strings.Join(lines, "\n")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func title() []string {
|
|
|
|
|
return []string{
|
|
|
|
|
"=========================================",
|
2020-06-03 02:11:35 +00:00
|
|
|
"================ Gluetun ================",
|
|
|
|
|
"=========================================",
|
|
|
|
|
"==== A mix of OpenVPN, DNS over TLS, ====",
|
|
|
|
|
"======= Shadowsocks and Tinyproxy =======",
|
|
|
|
|
"========= all glued up with Go ==========",
|
|
|
|
|
"=========================================",
|
|
|
|
|
"=========== For tunneling to ============",
|
|
|
|
|
"======== your favorite VPN server =======",
|
2020-02-06 20:42:46 -05:00
|
|
|
"=========================================",
|
|
|
|
|
"=== Made with " + emoji.Sprint(":heart:") + " by github.com/qdm12 ====",
|
|
|
|
|
"=========================================",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-04 23:47:21 +00:00
|
|
|
func announcement() []string {
|
|
|
|
|
if len(constants.Announcement) == 0 {
|
2020-02-25 11:46:52 +00:00
|
|
|
return nil
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
2020-03-04 23:47:21 +00:00
|
|
|
expirationDate, _ := time.Parse("2006-01-02", constants.AnnouncementExpiration) // error covered by a unit test
|
2020-02-25 11:46:52 +00:00
|
|
|
if time.Now().After(expirationDate) {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
2020-03-04 23:47:21 +00:00
|
|
|
return []string{emoji.Sprint(":mega: ") + constants.Announcement}
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func links() []string {
|
|
|
|
|
return []string{
|
|
|
|
|
emoji.Sprint(":wrench: ") + "Need help? " + constants.IssueLink,
|
|
|
|
|
emoji.Sprint(":computer: ") + "Email? quentin.mcgaw@gmail.com",
|
|
|
|
|
emoji.Sprint(":coffee: ") + "Slack? Join from the Slack button on Github",
|
|
|
|
|
emoji.Sprint(":money_with_wings: ") + "Help me? https://github.com/sponsors/qdm12",
|
|
|
|
|
}
|
|
|
|
|
}
|