|
|
@@ -38,6 +38,7 @@ type Config struct {
|
|
38
|
38
|
StatsIP net.IP
|
|
39
|
39
|
|
|
40
|
40
|
Secret []byte
|
|
|
41
|
+ AdTag []byte
|
|
41
|
42
|
}
|
|
42
|
43
|
|
|
43
|
44
|
// URLs contains links to the proxy (tg://, t.me) and their QR codes.
|
|
|
@@ -89,7 +90,7 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
|
|
89
|
90
|
publicIPv4 net.IP, PublicIPv4Port uint16,
|
|
90
|
91
|
publicIPv6 net.IP, publicIPv6Port uint16,
|
|
91
|
92
|
statsIP net.IP, statsPort uint16,
|
|
92
|
|
- secret string) (*Config, error) {
|
|
|
93
|
+ secret, adtag string) (*Config, error) {
|
|
93
|
94
|
if len(secret) != 32 {
|
|
94
|
95
|
return nil, errors.New("Telegram demands secret of length 32")
|
|
95
|
96
|
}
|
|
|
@@ -98,6 +99,14 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
|
|
98
|
99
|
return nil, errors.Annotate(err, "Cannot create config")
|
|
99
|
100
|
}
|
|
100
|
101
|
|
|
|
102
|
+ var adTagBytes []byte
|
|
|
103
|
+ if len(adtag) != 0 {
|
|
|
104
|
+ adTagBytes, err = hex.DecodeString(adtag)
|
|
|
105
|
+ if err != nil {
|
|
|
106
|
+ return nil, errors.Annotate(err, "Cannot create config")
|
|
|
107
|
+ }
|
|
|
108
|
+ }
|
|
|
109
|
+
|
|
101
|
110
|
if publicIPv4 == nil {
|
|
102
|
111
|
publicIPv4, err = getGlobalIPv4()
|
|
103
|
112
|
if err != nil {
|
|
|
@@ -138,6 +147,7 @@ func NewConfig(debug, verbose bool, // nolint: gocyclo
|
|
138
|
147
|
StatsIP: statsIP,
|
|
139
|
148
|
StatsPort: statsPort,
|
|
140
|
149
|
Secret: secretBytes,
|
|
|
150
|
+ AdTag: adTagBytes,
|
|
141
|
151
|
}
|
|
142
|
152
|
|
|
143
|
153
|
return conf, nil
|