mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-17 17:48:40 +00:00
Collect stats and possible padding (previously Vision Reader Writer) to all traffic
This commit is contained in:
parent
9b48673725
commit
68881b531e
4 changed files with 21 additions and 28 deletions
|
@ -142,8 +142,8 @@ type OutboundState struct {
|
|||
UplinkWriterDirectCopy bool
|
||||
}
|
||||
|
||||
func NewTrafficState(userUUID []byte) *TrafficState {
|
||||
return &TrafficState{
|
||||
func NewTrafficState(userUUID []byte, flow string) *TrafficState {
|
||||
var state = TrafficState{
|
||||
UserUUID: userUUID,
|
||||
StartTime: time.Time{},
|
||||
ByteSent: 0,
|
||||
|
@ -157,26 +157,29 @@ func NewTrafficState(userUUID []byte) *TrafficState {
|
|||
Cipher: 0,
|
||||
RemainingServerHello: -1,
|
||||
Inbound: InboundState{
|
||||
WithinPaddingBuffers: true,
|
||||
UplinkReaderDirectCopy: false,
|
||||
RemainingCommand: -1,
|
||||
RemainingContent: -1,
|
||||
RemainingPadding: -1,
|
||||
CurrentCommand: 0,
|
||||
IsPadding: true,
|
||||
DownlinkWriterDirectCopy: false,
|
||||
},
|
||||
Outbound: OutboundState{
|
||||
WithinPaddingBuffers: true,
|
||||
DownlinkReaderDirectCopy: false,
|
||||
RemainingCommand: -1,
|
||||
RemainingContent: -1,
|
||||
RemainingPadding: -1,
|
||||
CurrentCommand: 0,
|
||||
IsPadding: true,
|
||||
UplinkWriterDirectCopy: false,
|
||||
},
|
||||
}
|
||||
if len(flow) > 0 {
|
||||
state.Inbound.IsPadding = true;
|
||||
state.Outbound.IsPadding = true;
|
||||
state.Inbound.WithinPaddingBuffers = true;
|
||||
state.Outbound.WithinPaddingBuffers = true;
|
||||
}
|
||||
return &state
|
||||
}
|
||||
|
||||
// VisionReader is used to read xtls vision protocol
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue