-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restore peers #35
Comments
Did you figure it out? |
no, first was a format error. first I lost an "," the correct format where: } but than I get an new think: { i don't know what's the correct way |
@muplagama As of now, the feature to support arrays isn't available. However, we're open to contributions! Feel free to submit a PR if you'd like to add this functionality. |
I dont know... for next time will get it over bash and a simple list to backup it. xxx:~/vpn/backup# cat interfaces/peers/all_150.json and after I send a request with every url_save_public_key to save an json for every peer.. |
@muplagama Yes, that's one way to do it. Alternatively, you could restore peers using the wg-quick file and wg-quick tools. |
what do you mean |
You can export the configuration to the /etc/wireguard/wg0.conf file, and then use the wg-quick tool to restore it. |
ok, but I think a restore via the API is better :) |
hey... I backup the peers by ready api and stored into a file. he shows:
analpflaster:~/vpn/backup# cat interfaces/peers_150.json
[
{
"public_key": "HiCUb0B3yDHIl+0uI+2QhtOaWnLO3ld1CI3xINDcZEc=",
"url_safe_public_key": "HiCUb0B3yDHIl-0uI-2QhtOaWnLO3ld1CI3xINDcZEc=",
"allowed_ips": [
"172.1.4.1/32"
],
"last_handshake_time": "0001-01-01T00:00:00Z",
"persistent_keepalive_interval": "25s",
"endpoint": "146.60.226.118:64096",
"receive_bytes": 0,
"transmit_bytes": 3996
}
{
"public_key": "5zaLcXXvX1zRD25jjwv0rNCcKqu6QocYuul5vUjkhFk=",
"url_safe_public_key": "5zaLcXXvX1zRD25jjwv0rNCcKqu6QocYuul5vUjkhFk=",
"allowed_ips": [
"172.1.4.2/32"
],
"last_handshake_time": "0001-01-01T00:00:00Z",
"persistent_keepalive_interval": "25s",
"endpoint": "",
"receive_bytes": 0,
"transmit_bytes": 0
}
]
if I will restore it by using this json file I got an error:
{"message":"Syntax error: offset=350, error=invalid character '{' after array element"}
I used for restore:
curl -iv POST -H 'Content-Type: application/json' -H "Authorization: Bearer $_key" -d @interfaces/peers_150.json $_api/$_interface1/peers/
The text was updated successfully, but these errors were encountered: