示例#1
0
 private static VpnCredentials Map(VpnCredentialsContract credentials)
 {
     return(new VpnCredentials(
                credentials.Username,
                credentials.Password
                ));
 }
 private VpnConnectionRequestContract GetConnectionRequestContract()
 {
     return(new()
     {
         Credentials = new VpnCredentialsContract
         {
             ClientCertPem = "cert",
             ClientKeyPair = new AsymmetricKeyPairContract
             {
                 PublicKey = new PublicKeyContract
                 {
                     Algorithm = KeyAlgorithmContract.Ed25519,
                     Base64 = PublicKey,
                     Bytes = new byte[0],
                     Pem = string.Empty
                 },
                 SecretKey = new SecretKeyContract
                 {
                     Algorithm = KeyAlgorithmContract.Ed25519,
                     Base64 = PrivateKey,
                     Bytes = new byte[0],
                     Pem = string.Empty
                 }
             }
         },
         Servers = new VpnHostContract[]
         {
             new()
             {
                 Ip = "127.0.0.999",
                 Label = string.Empty,
                 X25519PublicKey = new ServerPublicKeyContract
                 {
                     Algorithm = KeyAlgorithmContract.X25519,
                     Base64 = ServerPublicKey,
                     Bytes = new byte[0],
                     Pem = string.Empty
                 }
             },
         },
         VpnConfig = new VpnConfigContract {
             CustomDns = new List <string>()
         }
     });