Browse Source

Add VLite Client Support for Packet Armor

Shelikhoo 3 years ago
parent
commit
322c8cc663
2 changed files with 6 additions and 0 deletions
  1. 1 0
      proxy/vlite/outbound/config.proto
  2. 5 0
      proxy/vlite/outbound/outbound.go

+ 1 - 0
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;
 }

+ 5 - 0
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)