mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
Merge 45b2af12d0 into cb9a5d6d69
This commit is contained in:
commit
6e767d94d9
2 changed files with 4 additions and 0 deletions
|
|
@ -30,6 +30,7 @@
|
|||
<help>DynDNS Server hostname or uri to use (depending on the protocol).
|
||||
When a URI is provided, the tag __MYIP__ will be replaced with the current detected address for this service
|
||||
and __HOSTNAME__ will contain the (comma separated) list of hostnames provided.
|
||||
If the current address is an IPv6 the tag __IPV6PREFIX__ will be replaced with the /64 prefix of the current address.
|
||||
</help>
|
||||
<style>optional_setting service_custom service_powerdns</style>
|
||||
</field>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
import ipaddress
|
||||
import syslog
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
|
|
@ -71,6 +72,8 @@ class DynDNS2(BaseAccount):
|
|||
url = self.settings.get('server')
|
||||
url = url.replace('__MYIP__', self.current_address)
|
||||
url = url.replace('__HOSTNAME__', self.settings.get('hostnames'))
|
||||
if self.current_address.find(':') > 0:
|
||||
url = url.replace('__IPV6PREFIX__', str(ipaddress.ip_network("%s/64" % self.current_address, strict=False)))
|
||||
req = requests.request(
|
||||
method=protocol,
|
||||
url=url,
|
||||
|
|
|
|||
Loading…
Reference in a new issue