Skip to content

Commit

Permalink
Wireguard implementation (#92)
Browse files Browse the repository at this point in the history
* Add files via upload

Wireguard peer implementation

* Wireguard interface implementation
  • Loading branch information
Hackerprod committed Aug 12, 2023
1 parent e286e11 commit c2d27b4
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tik4net.objects/Interface/InterfaceWireguard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tik4net.Objects.Interface
{
/// <summary>
/// Wireguard Interface
/// </summary>
[TikEntity("/interface/wireguard")]
public class InterfaceWireguard
{
/// <summary>
/// .id: primary key of row
/// </summary>
[TikProperty(".id", IsReadOnly = true, IsMandatory = true)]
public string Id { get; private set; }

/// <summary>
/// Name of the wireguard interface
/// </summary>
[TikProperty("name")]
public string Name { get; set; }

/// <summary>
/// comment: Short description of the Peer.
/// </summary>
[TikProperty("comment")]
public string Comment { get; set; }

/// <summary>
/// disabled: Whether peer will be used.
/// </summary>
[TikProperty("disabled", DefaultValue = "no")]
public bool Disabled { get; set; }

/// <summary>
/// mtu: Layer3 Maximum transmission unit
///
/// integer [0..65536]
/// </summary>
[TikProperty("mtu", DefaultValue = "1420")]
public int /*integer [0..65536]*/ Mtu { get; set; }

/// <summary>
/// The private key associated with the local device
/// </summary>
[TikProperty("private-key")]
public string PrivateKey { get; set; }

/// <summary>
/// Interface listen port
/// </summary>
[TikProperty("listen-port", DefaultValue = "13231")]
public int ListenPort { get; set; }
}
}
68 changes: 68 additions & 0 deletions tik4net.objects/Wireguard/WireguardPeer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tik4net.Objects.Wireguard
{
/// <summary>
/// Specific remote entity or device with which the local device establishes a secure communication tunnel
/// </summary>
[TikEntity("/interface/wireguard/peers")]
public class WireguardPeer
{
/// <summary>
/// .id: primary key of row
/// </summary>
[TikProperty(".id", IsReadOnly = true, IsMandatory = true)]
public string Id { get; private set; }

/// <summary>
/// IP addresses or subnets that are allowed to communicate with that peer
/// </summary>
[TikProperty("allowed-address")]
public string AllowedAddress { get; set; }

/// <summary>
/// comment: Short description of the Peer.
/// </summary>
[TikProperty("comment")]
public string Comment { get; set; }

/// <summary>
/// disabled: Whether peer will be used.
/// </summary>
[TikProperty("disabled", DefaultValue = "no")]
public bool Disabled { get; set; }

/// <summary>
/// Specifies the local network interface that the peer is associated with
/// </summary>
[TikProperty("interface", DefaultValue = "")]
public string Interface { get; set; }

/// <summary>
/// shared secret cryptographic key that is preconfigured between two peers
/// </summary>
[TikProperty("preshared-key", DefaultValue = "")]
public string PresharedKey { get; set; }

/// <summary>
/// The IP address and port number of the remote endpoint or server that the peer will connect to.
/// </summary>
[TikProperty("endpoint-address")]
public string EndpointAddress { get; set; }

/// <summary>
/// Specifies the specific port number on the remote endpoint or server that the peer will connect to.
/// </summary>
[TikProperty("endpoint-port")]
public int EndpointPort { get; set; }

/// <summary>
/// The public key associated with the remote peer
/// </summary>
[TikProperty("public-key" )]
public string PublicKey { get; set; }
}
}

0 comments on commit c2d27b4

Please sign in to comment.