From 322c8cc6630df373c4bf0f14b866d180d35d1562 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Wed, 13 Apr 2022 23:30:53 +0100 Subject: [PATCH] Add VLite Client Support for Packet Armor --- proxy/vlite/outbound/config.proto | 1 + proxy/vlite/outbound/outbound.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/proxy/vlite/outbound/config.proto b/proxy/vlite/outbound/config.proto index be06b34f6..4319a2d3c 100644 --- a/proxy/vlite/outbound/config.proto +++ b/proxy/vlite/outbound/config.proto @@ -20,4 +20,5 @@ message UDPProtocolConfig { bool enable_fec = 5; bool enable_stabilization = 6; bool enable_renegotiation = 7; + uint32 handshake_masking_padding_size = 8; } \ No newline at end of file diff --git a/proxy/vlite/outbound/outbound.go b/proxy/vlite/outbound/outbound.go index 92e736bdf..fc49fa594 100644 --- a/proxy/vlite/outbound/outbound.go +++ b/proxy/vlite/outbound/outbound.go @@ -130,6 +130,11 @@ func createStatusFromConfig(config *UDPProtocolConfig) (*status, error) { ctx = context.WithValue(ctx, interfaces.ExtraOptionsUDPMask, string(s.password)) + if config.HandshakeMaskingPaddingSize != 0 { + ctxv := &interfaces.ExtraOptionsUsePacketArmorValue{PacketArmorPaddingTo: int(config.HandshakeMaskingPaddingSize), UsePacketArmor: true} + ctx = context.WithValue(ctx, interfaces.ExtraOptionsUsePacketArmor, ctxv) + } + destinationString := fmt.Sprintf("%v:%v", config.Address.AsAddress().String(), config.Port) s.udpdialer = udpClient.NewUdpClient(destinationString, ctx)