File tree 2 files changed +13
-0
lines changed 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package tgtest
2
2
3
3
import (
4
4
"context"
5
+ "crypto/rsa"
5
6
"io"
6
7
"net"
7
8
"time"
@@ -49,6 +50,13 @@ type Server struct {
49
50
log * zap.Logger // immutable
50
51
}
51
52
53
+ // NewPrivateKey creates new private key from RSA private key.
54
+ func NewPrivateKey (k * rsa.PrivateKey ) exchange.PrivateKey {
55
+ return exchange.PrivateKey {
56
+ RSA : k ,
57
+ }
58
+ }
59
+
52
60
// NewServer creates new Server.
53
61
func NewServer (key exchange.PrivateKey , handler Handler , opts ServerOptions ) * Server {
54
62
opts .setDefaults ()
Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ func (p Protocol) Codec() Codec {
54
54
return p .codec ()
55
55
}
56
56
57
+ // CodecNoHeader is Codec without header.
58
+ func (p Protocol ) CodecNoHeader () Codec {
59
+ return codec.NoHeader {Codec : p .codec ()}
60
+ }
61
+
57
62
// Handshake inits given net.Conn as MTProto connection.
58
63
func (p Protocol ) Handshake (conn net.Conn ) (Conn , error ) {
59
64
connCodec := p .codec ()
You can’t perform that action at this time.
0 commit comments