mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-03-21 11:41:51 +00:00
huh
This commit is contained in:
@@ -16,6 +16,7 @@ defmodule FzHttp.Devices.Device do
|
||||
field :private_key, FzHttp.Encrypted.Binary
|
||||
field :server_public_key, :string
|
||||
field :remote_ip, EctoNetwork.INET
|
||||
field :octet_sequence, :integer, read_after_writes: true
|
||||
field :interface_address4, EctoNetwork.INET
|
||||
field :interface_address6, EctoNetwork.INET
|
||||
field :last_seen_at, :utc_datetime_usec
|
||||
@@ -30,6 +31,7 @@ defmodule FzHttp.Devices.Device do
|
||||
|> cast(attrs, [
|
||||
:allowed_ips,
|
||||
:remote_ip,
|
||||
:octet_sequence,
|
||||
:interface_address4,
|
||||
:interface_address6,
|
||||
:server_public_key,
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
</dt>
|
||||
<dd><%= @device.name %></dd>
|
||||
|
||||
<dt>
|
||||
<strong>Interface IP:</strong>
|
||||
</dt>
|
||||
<dd>10.3.2.<%= @device.octet_sequence %></dd>
|
||||
|
||||
<dt>
|
||||
<strong>Public key:</strong>
|
||||
</dt>
|
||||
@@ -77,7 +82,7 @@
|
||||
<pre><code id="wg-conf">
|
||||
[Interface]
|
||||
PrivateKey = <%= @device.private_key %>
|
||||
Address = 172.16.99.1/24
|
||||
Address = 10.3.2.<%= @device.octet_sequence %>
|
||||
DNS = 1.1.1.1, 1.0.0.1
|
||||
|
||||
[Peer]
|
||||
|
||||
@@ -10,6 +10,8 @@ defmodule FzHttp.Repo.Migrations.CreateDevices do
|
||||
add :private_key, :bytea, null: false
|
||||
add :server_public_key, :string, null: false
|
||||
add :remote_ip, :inet
|
||||
# XXX: Rework this in app code
|
||||
add :octet_sequence, :serial
|
||||
add :interface_address4, :inet
|
||||
add :interface_address6, :inet
|
||||
add :last_seen_at, :utc_datetime_usec
|
||||
@@ -23,5 +25,6 @@ defmodule FzHttp.Repo.Migrations.CreateDevices do
|
||||
create unique_index(:devices, [:private_key])
|
||||
create unique_index(:devices, [:preshared_key])
|
||||
create unique_index(:devices, [:user_id, :name])
|
||||
create unique_index(:devices, [:octet_sequence])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user