Add secure mode

This commit is contained in:
9seconds
2018-07-10 09:37:04 +03:00
parent 25d02cf120
commit 3d8ffdcc56
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"net"
"strconv"
"strings"
"github.com/juju/errors"
)
@@ -90,6 +91,9 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
publicIPv6 net.IP, publicIPv6Port uint16,
statsIP net.IP, statsPort uint16,
secret, adtag string) (*Config, error) {
if strings.HasPrefix(secret, "dd") {
secret = secret[2:]
}
if len(secret) != 32 {
return nil, errors.New("Telegram demands secret of length 32")
}