dashboardobfuscationwireguard-vpn-setupwireguard-vpnwireguard-tunnelwireguard-dashboardwireguardwg-managervpnsite-to-site
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
570 B
26 lines
570 B
5 years ago
|
from fastapi import APIRouter
|
||
|
|
||
|
import middleware
|
||
|
import schemas
|
||
|
import script.wireguard
|
||
|
|
||
|
router = APIRouter()
|
||
|
|
||
|
|
||
|
@router.get("/generate_psk", response_model=schemas.PSK)
|
||
|
def generate_psk():
|
||
|
return schemas.PSK(
|
||
|
psk=script.wireguard.generate_psk()
|
||
|
)
|
||
|
|
||
|
|
||
|
@router.get("/generate_keypair", response_model=schemas.KeyPair)
|
||
|
def generate_key_pair():
|
||
|
keys = script.wireguard.generate_keys()
|
||
|
private_key = keys["private_key"]
|
||
|
public_key = keys["public_key"]
|
||
|
return schemas.KeyPair(
|
||
|
private_key=private_key,
|
||
|
public_key=public_key
|
||
|
)
|