rejetto forum

Only one thing that wasn't released about HFS...

0 Members and 1 Guest are viewing this topic.

Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
I totally agree!  100%
HFS should be completely independent!
Hi Rejetto! :D After reading this comment, I've realized there is only one thing that wasn't released about HFS: the PHP code that runs behind hfstest.rejetto.com (Self test). I guess it must be a very simple code (something that any PHP coder could easily replicate it). Anyway, if you could please share it, I would like to have it, to analyze and learn from it (I know it makes a 'ping' from your server to the user's IP, and then it gives a reply with a code).

Do you mind sharing it here? :) (or privately via PM)

Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
the procedure to reproduce in php seems to be the following

php receives a request from hfs in this format

Code: [Select]
http://hfstest.rejetto.com/?port={external_port}&host={external_ip|dns_name}&natted={no|yes}this should generate a new request using a second channel  from php to hfs on the url of the form

Code: [Select]
http://%host%:%port%/test
if hfs is indeed accessible from the web with this url then it sends as response to php the text 'HFS OK'

from then on the php returns a text by the first channel with '1' as the correct functioning response, otherwise an empty string in the event of an error


*************************************

technically it is possible to simulate this exchange using two hfs sessions and forcing a redirection from hfstest.rejetto.com to a local ip in the windows 'hosts' file by adding this line

127.0.0.1 hfstest.rejetto.com

the server must appear as the php must be launched to listen to it on port 80 and active on 'Any Address'

in the root put  as diff template
[]
1


launch another session of hfs listening on any port other than 80, then launch the "self test", the response obtained will be positively successful

you can also perform this experiment by replacing the localhost address with the local ip (192.168.1.xxx)

If we also use the 'self test' of the hfs of port 80 as a self test, the response will also be positive with 127.0.0.1 , but no response with 192.168.1.xxx
« Last Edit: October 25, 2022, 08:31:07 PM by Mars »


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
You have read my mind. ;D That's right, I was thinking of using another HFS's instance, to simulate the server (to have an alternative, just in case if someday Rejetto's servers are down). Editing the Windows hosts is one option (and the other is compiling my own executable, and for example, changing 'hfstest.rejetto.com' to a 'xxxxxx.no-ip.com' address).

in the root put  as diff template
[]
1

Yes, that would work (the valid options are: '1' is when is the server is reachable; '2' is when no port specified and '3' is when server does not answer).

And although that would work, you can also run PHP code directly from HFS by calling php.exe using 'exec' (taking as an example, the work done by 'raybob' on his 'FHFS', here).

But I'm interested in having the original PHP code Rejetto have used, because it has a part that would be somewhat difficult for me to replicate (due to my limited knowledge). I mean the part where it detects if is NATted (NAT detection), here:

Quote
http:// hfstest.rejetto.com/ ?port={external_port}&host={external_ip|dns_name}&natted={no|yes}

That's why I hope Rejetto could share the PHP code he is using. :)

He already had released the PHP code for 'ip.php' (for detecting the external IP), here.

So, the only missing code, is the PHP script for 'hfstest.rejetto.com'.
« Last Edit: October 26, 2022, 09:30:34 AM by LeoNeeson »
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
hi Leo, i've not being receiving notifications from the forum and only now I saw your flashing signature :D
you have my email address, next time send me the link to your post if you want to catch my attention.

I had to remove from the source the part related to antiflood because it is bound to my database
« Last Edit: January 02, 2023, 10:53:47 PM by rejetto »


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 842
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Thanks for the file! (I will try it on my spare time)

I had to remove from the source the part related to antiflood because it is bound to my database
That's fine (it's fair and understandable), and it's not quite important since it's unrelated to HFS (there are plenty PHP antiflood scripts on Google).

you have my email address, next time send me the link to your post if you want to catch my attention.
Yeah, but I didn't want to bother you (I'll keep it in mind for next time)

Grazie mille! :D
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.