mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:34:02 +03:00
Fix linting
This commit is contained in:
+6
-3
@@ -67,12 +67,15 @@ func (c *Config) UseMiddleProxy() bool {
|
|||||||
return len(c.AdTag) > 0
|
return len(c.AdTag) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) SecretString() string {
|
// BotSecretString returns secret string which should work with MTProxybot.
|
||||||
|
func (c *Config) BotSecretString() string {
|
||||||
return hex.EncodeToString(c.Secret)
|
return hex.EncodeToString(c.Secret)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) BotSecretString() string {
|
// SecretString returns a secret in a form entered on the start of the
|
||||||
secret := c.SecretString()
|
// application.
|
||||||
|
func (c *Config) SecretString() string {
|
||||||
|
secret := c.BotSecretString()
|
||||||
if c.SecureMode {
|
if c.SecureMode {
|
||||||
return "dd" + secret
|
return "dd" + secret
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import (
|
|||||||
"github.com/9seconds/mtg/mtproto"
|
"github.com/9seconds/mtg/mtproto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// MTProtoIntermediateSecure is an extension of MTProtoIntermediate
|
||||||
|
// mode which supports random paddings (socalled 'secure mode' or
|
||||||
|
// 'dd-secrets').
|
||||||
type MTProtoIntermediateSecure struct {
|
type MTProtoIntermediateSecure struct {
|
||||||
MTProtoIntermediate
|
MTProtoIntermediate
|
||||||
}
|
}
|
||||||
@@ -41,7 +44,7 @@ func (m *MTProtoIntermediateSecure) Write(p []byte) (int, error) {
|
|||||||
paddingLength := rand.Intn(4)
|
paddingLength := rand.Intn(4)
|
||||||
buf.Grow(4 + len(p) + paddingLength)
|
buf.Grow(4 + len(p) + paddingLength)
|
||||||
|
|
||||||
binary.Write(buf, binary.LittleEndian, uint32(len(p)+paddingLength))
|
binary.Write(buf, binary.LittleEndian, uint32(len(p)+paddingLength)) // nolint: errcheck
|
||||||
buf.Write(p)
|
buf.Write(p)
|
||||||
buf.Write(make([]byte, paddingLength))
|
buf.Write(make([]byte, paddingLength))
|
||||||
|
|
||||||
@@ -58,6 +61,8 @@ func (m *MTProtoIntermediateSecure) Write(p []byte) (int, error) {
|
|||||||
return len(p), err
|
return len(p), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewMTProtoIntermediateSecure create new instance of
|
||||||
|
// MTProtoIntermediateSecure instance.
|
||||||
func NewMTProtoIntermediateSecure(conn StreamReadWriteCloser, opts *mtproto.ConnectionOpts) PacketReadWriteCloser {
|
func NewMTProtoIntermediateSecure(conn StreamReadWriteCloser, opts *mtproto.ConnectionOpts) PacketReadWriteCloser {
|
||||||
return &MTProtoIntermediateSecure{
|
return &MTProtoIntermediateSecure{
|
||||||
MTProtoIntermediate: MTProtoIntermediate{
|
MTProtoIntermediate: MTProtoIntermediate{
|
||||||
|
|||||||
Reference in New Issue
Block a user