-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for domene.shop provider
Add support for Norwegian DDNS provider https://domene.shop/ API documentation available online at: https://api.domeneshop.no/docs/#tag/ddns/paths/~1dyndns~1update/get
- Loading branch information
Showing
5 changed files
with
131 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Inadyn v2.0 configuration file format | ||
period = 300 | ||
allow-ipv6 = true | ||
#verify-address = false | ||
|
||
# To generate credentials, visit this page: | ||
# https://domene.shop/admin?view=api | ||
provider domene.shop { | ||
username = token | ||
password = secret | ||
hostname = { "subdomain.domene.shop", "*.domene.shop" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
inadyn_SOURCES += common.c changeip.c cloudflare.c porkbun.c \ | ||
cloudxns.c ddnss.c dhis.c \ | ||
dnsexit.c dnspod.c duckdns.c \ | ||
duiadns.c dyndns.c dynv6.c \ | ||
easydns.c freedns.c freemyip.c \ | ||
generic.c giradns.c \ | ||
sitelutions.c tunnelbroker.c \ | ||
yandex.c zoneedit.c goip.c \ | ||
desec.c domaindiscount24.c all-inkl.c \ | ||
core-networks.c dnsever.c dnshome.c \ | ||
dnsmadeeasy.c dnsmax.c mydns.c \ | ||
myonlineportal.c namecheap.c regfish.c \ | ||
twodns.c ipv64.c | ||
inadyn_SOURCES += common.c changeip.c cloudflare.c porkbun.c \ | ||
cloudxns.c ddnss.c dhis.c \ | ||
dnsexit.c dnspod.c duckdns.c \ | ||
duiadns.c dyndns.c dynv6.c \ | ||
easydns.c freedns.c freemyip.c \ | ||
generic.c giradns.c \ | ||
sitelutions.c tunnelbroker.c \ | ||
yandex.c zoneedit.c goip.c \ | ||
desec.c domaindiscount24.c all-inkl.c \ | ||
core-networks.c dnsever.c dnshome.c \ | ||
dnsmadeeasy.c dnsmax.c mydns.c \ | ||
myonlineportal.c namecheap.c regfish.c \ | ||
twodns.c ipv64.c domeneshop.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* Plugin for domene.shop | ||
* | ||
* Copyright (C) 2024 Kenan Amundsen Elkoca <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, visit the Free Software Foundation | ||
* website at http://www.gnu.org/licenses/gpl-2.0.html or write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#include "plugin.h" | ||
|
||
/* https://api.domeneshop.no/docs/#tag/ddns/paths/~1dyndns~1update/get */ | ||
#define DOMENESHOP_UPDATE_IP_REQUEST \ | ||
"GET %s?" \ | ||
"hostname=%s&" \ | ||
"myip=%s " \ | ||
"HTTP/1.1\r\n" \ | ||
"Host: %s\r\n" \ | ||
"Authorization: Basic %s\r\n" \ | ||
"User-Agent: %s\r\n\r\n" | ||
|
||
static int request (ddns_t *ctx, ddns_info_t *info, ddns_alias_t *alias); | ||
static int response (http_trans_t *trans, ddns_info_t *info, ddns_alias_t *alias); | ||
static int check_response_code (int status); | ||
|
||
static ddns_system_t domeneshop = { | ||
.name = "[email protected]", | ||
|
||
.request = (req_fn_t)request, | ||
.response = (rsp_fn_t)response, | ||
|
||
.checkip_name = DYNDNS_MY_IP_SERVER, | ||
.checkip_url = DYNDNS_MY_CHECKIP_URL, | ||
.checkip_ssl = DYNDNS_MY_IP_SSL, | ||
|
||
.server_name = "api.domeneshop.no", | ||
.server_url = "/v0/dyndns/update" | ||
}; | ||
|
||
static int request(ddns_t *ctx, ddns_info_t *info, ddns_alias_t *alias) | ||
{ | ||
return snprintf(ctx->request_buf, ctx->request_buflen, | ||
info->system->server_req, | ||
info->server_url, | ||
alias->name, | ||
alias->address, | ||
info->server_name.name, | ||
info->creds.encoded_password, | ||
info->user_agent); | ||
} | ||
|
||
static int check_response_code(int status) | ||
{ | ||
if (status == 204) | ||
return RC_OK; | ||
|
||
return http_status_valid(status); | ||
} | ||
|
||
static int response(http_trans_t *trans, ddns_info_t *info, ddns_alias_t *alias) | ||
{ | ||
int rc; | ||
char *body = trans->rsp_body; | ||
|
||
(void)info; | ||
(void)alias; | ||
|
||
rc = check_response_code(trans->status); | ||
|
||
if (rc == RC_OK && !strstr(body, "")) | ||
rc = RC_DDNS_RSP_NOTOK; | ||
|
||
return rc; | ||
} | ||
|
||
PLUGIN_INIT(plugin_init) | ||
{ | ||
plugin_register(&domeneshop, DOMENESHOP_UPDATE_IP_REQUEST); | ||
} | ||
|
||
PLUGIN_EXIT(plugin_exit) | ||
{ | ||
plugin_unregister(&domeneshop); | ||
} | ||
|
||
/** | ||
* Local Variables: | ||
* indent-tabs-mode: t | ||
* c-file-style: "linux" | ||
* End: | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters