Add intermediate secure wrapper

This commit is contained in:
9seconds
2018-07-12 22:00:48 +03:00
parent 94c2f3c215
commit 607f4f42c4
2 changed files with 78 additions and 2 deletions
+9 -2
View File
@@ -17,9 +17,16 @@ func MiddleInit(socket net.Conn, connID string, conf *config.Config) (wrappers.W
}
connStream := conn.(wrappers.StreamReadWriteCloser)
newConn := wrappers.NewMTProtoAbridged(connStream, opts)
if opts.ConnectionType != mtproto.ConnectionTypeAbridged {
var newConn wrappers.PacketReadWriteCloser
switch opts.ConnectionType {
case mtproto.ConnectionTypeAbridged:
newConn = wrappers.NewMTProtoAbridged(connStream, opts)
case mtproto.ConnectionTypeIntermediate:
newConn = wrappers.NewMTProtoIntermediate(connStream, opts)
case mtproto.ConnectionTypeSecure:
newConn = wrappers.NewMTProtoIntermediateSecure(connStream, opts)
default:
panic("Unknown connection type")
}
opts.ConnectionProto = mtproto.ConnectionProtocolIPv4