Skip to content

Manage Peers with Nix #100

Description

@Keyruu

Hi awesome project and exactly what I was looking for, the only problem I have is that I would want to be able to define peers via the NixOS module, but the resulting dsnetconfig.json looks like this:

{
    "ExternalHostname": "vpn.redacted.net",
    "ExternalIP": "redacted",
    "ExternalIP6": "",
    "ListenPort": 51820,
    "Domain": "dsnet",
    "InterfaceName": "dsnet",
    "Network": "10.61.120.0/22",
    "Network6": "fd00:d39:b640:2800::/64",
    "IP": "10.61.120.1",
    "IP6": "fd00:d39:b640:2800:dd88:9208:2fe4:b6e6",
    "DNS": "",
    "Networks": [],
    "PrivateKey": "redacted",
    "PostUp": "",
    "PostDown": "",
    "Peers": [
        {
            "Hostname": "",
            "Owner": "",
            "Description": "",
            "IP": "",
            "IP6": "",
            "Added": "0001-01-01T00:00:00Z",
            "Networks": null,
            "PublicKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
            "PresharedKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        }
    ],
    "PersistentKeepalive": 25,
    "MTU": 1420
}

If I provide a peer like this in NixOS:

{
    "ExternalHostname": "vpn.redacted.net",
    "ExternalIP": "redacted",
    "ExternalIP6": "",
    "ListenPort": 51820,
    "Domain": "dsnet",
    "InterfaceName": "dsnet",
    "Network": "10.61.120.0/22",
    "Network6": "fd00:d39:b640:2800::/64",
    "IP": "10.61.120.1",
    "IP6": "fd00:d39:b640:2800:dd88:9208:2fe4:b6e6",
    "DNS": "",
    "Networks": [],
    "PrivateKey": "redacted",
    "PostUp": "",
    "PostDown": "",
    "Peers": [
        {
            "Hostname": "",
            "Owner": "",
            "Description": "",
            "IP": "",
            "IP6": "",
            "Added": "0001-01-01T00:00:00Z",
            "Networks": null,
            "PublicKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
            "PresharedKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        }
    ],
    "PersistentKeepalive": 25,
    "MTU": 1420
}

I'm still not sure on how to handle dsnet add in that case tho. But I would love to be able to generate the config via dsnet add and then just add it to my Nix config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions