Custom ip_method provider #21

Closed
opened 2025-11-20 04:18:52 -05:00 by saavagebueno · 6 comments
Owner

Originally created by @WhistleMaster on GitHub (Feb 28, 2020).

Originally assigned to: @qdm12 on GitHub.

Linked to the thoughts on the ip method, would it be possible to add a "custom" ip_method provider ?

Assuming that the user provides an URL, which would just return the IP ? You could provide the PHP file to be self-hosted by the user as well.

Any though on that one ?

Thanks !

Originally created by @WhistleMaster on GitHub (Feb 28, 2020). Originally assigned to: @qdm12 on GitHub. Linked to the thoughts on the ip method, would it be possible to add a "custom" `ip_method` provider ? Assuming that the user provides an URL, which would just return the IP ? You could provide the PHP file to be self-hosted by the user as well. Any though on that one ? Thanks !
Author
Owner

@qdm12 commented on GitHub (Feb 28, 2020):

Interesting, that would be possible and easy to implement. I'm not sure what you mean by giving a PHP file though. I'll probably do it right now.

It's also on my list to add my own https server to echo back IP addresses as I'm fed up with rate limiting on most websites out there.

Luckily for me, I have another server in another country so I can make them talk to each other to find out their IP addresses 😄

By the way, as you have an IPv6 address, isn't it constant over time? (I guess you can see in the UI)

@qdm12 commented on GitHub (Feb 28, 2020): Interesting, that would be possible and easy to implement. I'm not sure what you mean by giving a PHP file though. I'll probably do it right now. It's also on my list to add my own https server to echo back IP addresses as I'm fed up with rate limiting on most websites out there. Luckily for me, I have another server in another country so I can make them talk to each other to find out their IP addresses :smile: By the way, as you have an IPv6 address, isn't it constant over time? (I guess you can see in the UI)
Author
Owner

@WhistleMaster commented on GitHub (Feb 28, 2020):

I'm not sure what you mean by giving a PHP file though.

I had in mind a file that people could directly put on their hosted server, that you could provide as an example on your git. I said PHP because it's the most versatile and available on most hosting provider. Something like that.

@WhistleMaster commented on GitHub (Feb 28, 2020): > I'm not sure what you mean by giving a PHP file though. I had in mind a file that people could directly put on their hosted server, that you could provide as an example on your git. I said PHP because it's the most versatile and available on most hosting provider. Something like [that](https://github.com/dconroy/whatismyip/blob/master/index.php).
Author
Owner

@qdm12 commented on GitHub (Feb 28, 2020):

Oh interesting, I get it. I will probably do it in Go yet again because, unlike 99% of programming languages, the program is a statically compiled binary not requiring anything 👍 (no jvm, no php install, no python, etc. a bit like C).

I will probably release YADI (yet another Docker image) together with static binaries for each platforms/cpu arch, doing that in a few lines of code, and reference to it in the readme here.

Anyway, I just finished implementing a way to specify a custom URL to get your public IP and that you can specify for each record, if you feel like trying new methods 😉 I'd be happy to add them to the list of hardcoded urls.

@qdm12 commented on GitHub (Feb 28, 2020): Oh interesting, I get it. I will probably do it in Go yet again because, unlike 99% of programming languages, the program is a statically compiled binary not requiring anything 👍 (no jvm, no php install, no python, etc. a bit like C). I will probably release YADI (yet another Docker image) together with static binaries for each platforms/cpu arch, doing that in a few lines of code, and reference to it in the readme here. Anyway, I just finished implementing a way to specify a custom URL to get your public IP and that you can specify for each record, if you feel like trying new methods 😉 I'd be happy to add them to the list of hardcoded urls.
Author
Owner

@WhistleMaster commented on GitHub (Feb 28, 2020):

Thanks !

Another example of IP provider: https://www.ipify.org/

@WhistleMaster commented on GitHub (Feb 28, 2020): Thanks ! Another example of IP provider: https://www.ipify.org/
Author
Owner

@qdm12 commented on GitHub (Feb 29, 2020):

Also, you would need a server at a different location (not in the same LAN) to use that little self hosted http server returning you your IP address so that's probably not most of the people.

I'll add the code and docker image soon, and will host an instance over https on my server if people using this container want to use it as another public IP method.

@qdm12 commented on GitHub (Feb 29, 2020): Also, you would need a server at a different location (not in the same LAN) to use that little self hosted http server returning you your IP address so that's probably not most of the people. I'll add the code and docker image soon, and will host an instance over https on my server if people using this container want to use it as another public IP method.
Author
Owner

@WhistleMaster commented on GitHub (Mar 1, 2020):

Also, you would need a server at a different location (not in the same LAN) to use that little self hosted http server returning you your IP address so that's probably not most of the people.

Indeed. I'm using the following PHP script to return my IP:

<?php

function get_ip() {
	
	$address = $_SERVER['REMOTE_ADDR'];
	
	if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
		$address = $_SERVER['HTTP_X_FORWARDED_FOR'];
	} elseif (array_key_exists('HTTP_CLIENT_IP', $_SERVER) && !empty($_SERVER['HTTP_CLIENT_IP'])) {
		$address = $_SERVER['HTTP_CLIENT_IP'];
	}
	
	if (strpos($address, ",") > 0) {
		$ips = explode(",", $address);
		$address = trim($ips[0]);
	}
	
	return $address;
}

$user_ip = get_ip();
echo $user_ip;

?>
@WhistleMaster commented on GitHub (Mar 1, 2020): > Also, you would need a server at a different location (not in the same LAN) to use that little self hosted http server returning you your IP address so that's probably not most of the people. Indeed. I'm using the following PHP script to return my IP: ```php <?php function get_ip() { $address = $_SERVER['REMOTE_ADDR']; if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $address = $_SERVER['HTTP_X_FORWARDED_FOR']; } elseif (array_key_exists('HTTP_CLIENT_IP', $_SERVER) && !empty($_SERVER['HTTP_CLIENT_IP'])) { $address = $_SERVER['HTTP_CLIENT_IP']; } if (strpos($address, ",") > 0) { $ips = explode(",", $address); $address = trim($ips[0]); } return $address; } $user_ip = get_ip(); echo $user_ip; ?> ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ddns-updater#21