@@ -19,30 +19,6 @@ const (
19
19
commandPaddingDirect byte = 0x02
20
20
)
21
21
22
- func WriteWithPadding (buffer * buf.Buffer , p []byte , command byte , userUUID * uuid.UUID , paddingTLS bool ) {
23
- contentLen := int32 (len (p ))
24
- var paddingLen int32
25
- if contentLen < 900 {
26
- if paddingTLS {
27
- //log.Debugln("long padding")
28
- paddingLen = randv2 .Int32N (500 ) + 900 - contentLen
29
- } else {
30
- paddingLen = randv2 .Int32N (256 )
31
- }
32
- }
33
- if userUUID != nil {
34
- buffer .Write (userUUID .Bytes ())
35
- }
36
-
37
- buffer .WriteByte (command )
38
- binary .BigEndian .PutUint16 (buffer .Extend (2 ), uint16 (contentLen ))
39
- binary .BigEndian .PutUint16 (buffer .Extend (2 ), uint16 (paddingLen ))
40
- buffer .Write (p )
41
-
42
- buffer .Extend (int (paddingLen ))
43
- log .Debugln ("XTLS Vision write padding1: command=%v, payloadLen=%v, paddingLen=%v" , command , contentLen , paddingLen )
44
- }
45
-
46
22
func ApplyPadding (buffer * buf.Buffer , command byte , userUUID * uuid.UUID , paddingTLS bool ) {
47
23
contentLen := int32 (buffer .Len ())
48
24
var paddingLen int32
@@ -63,7 +39,7 @@ func ApplyPadding(buffer *buf.Buffer, command byte, userUUID *uuid.UUID, padding
63
39
}
64
40
65
41
buffer .Extend (int (paddingLen ))
66
- log .Debugln ("XTLS Vision write padding2 : command=%d, payloadLen=%d, paddingLen=%d" , command , contentLen , paddingLen )
42
+ log .Debugln ("XTLS Vision write padding : command=%d, payloadLen=%d, paddingLen=%d" , command , contentLen , paddingLen )
67
43
}
68
44
69
45
func ReshapeBuffer (buffer * buf.Buffer ) * buf.Buffer {
0 commit comments