Skip to content
Snippets Groups Projects
Select Git revision
  • dd_msg_area_chooser_coloring_fix_and_separator_char_fix
  • dailybuild_linux-x64
  • dailybuild_win32
  • master default protected
  • sqlite
  • rip_abstraction
  • dailybuild_macos-armv8
  • dd_file_lister_filanem_in_desc_color
  • mode7
  • dd_msg_reader_are_you_there_warning_improvement
  • c23-playing
  • syncterm-1.3
  • syncterm-1.2
  • test-build
  • hide_remote_connection_with_telgate
  • 638-can-t-control-c-during-a-file-search
  • add_body_to_pager_email
  • mingw32-build
  • cryptlib-3.4.7
  • ree/mastermind
  • sbbs320d
  • syncterm-1.6
  • syncterm-1.5
  • syncterm-1.4
  • sbbs320b
  • syncterm-1.3
  • syncterm-1.2
  • syncterm-1.2rc6
  • syncterm-1.2rc5
  • push
  • syncterm-1.2rc4
  • syncterm-1.2rc2
  • syncterm-1.2rc1
  • sbbs319b
  • sbbs318b
  • goodbuild_linux-x64_Sep-01-2020
  • goodbuild_win32_Sep-01-2020
  • goodbuild_linux-x64_Aug-31-2020
  • goodbuild_win32_Aug-31-2020
  • goodbuild_win32_Aug-30-2020
40 results

dyndns.js

Blame
    • Rob Swindell's avatar
      c47b2a79
      Remove old CVS tags, increment revision/version numbers where used · c47b2a79
      Rob Swindell authored
      The details (dates, author, revision numbers) are often stale and
      misleading, so start removing them. Where the Revision tag was used
      for a version/revision, just bump it by one and use a string constant
      instead (Git doesn't provide any similar facility for auto-incrementing
      revision numbers).
      
      More remains. Perhaps a commit hook to alert me when committing that I should
      clean up as I go rather than try to do this in bulk. <shrug>
      c47b2a79
      History
      Remove old CVS tags, increment revision/version numbers where used
      Rob Swindell authored
      The details (dates, author, revision numbers) are often stale and
      misleading, so start removing them. Where the Revision tag was used
      for a version/revision, just bump it by one and use a string constant
      instead (Git doesn't provide any similar facility for auto-incrementing
      revision numbers).
      
      More remains. Perhaps a commit hook to alert me when committing that I should
      clean up as I go rather than try to do this in bulk. <shrug>
    dyndns.js 2.43 KiB
    // dyndns.js
    
    // Client for Synchronet dynamic DNS service (yourbbs.synchro.net)
    
    // usage: ?dyndns <password> [ip_address] [-mx address]
    
    const REVISION = "1.22";
    const rx_log_level = LOG_INFO;
    const tx_log_level = LOG_DEBUG;
    
    printf("Synchronet Dynamic DNS Client %s\r\n", REVISION);
    
    host_list=["dyndns.synchro.net", "rob.synchro.net", "bbs.synchro.net", "cvs.synchro.net"];
    
    var quiet = false;
    
    function writeln(str)
    {
    	sock.send(str + "\r\n");
    	if(!quiet)
    		log(tx_log_level, "TX: " + str);
    }
    
    var options=load({}, "modopts.js", "dyndns");
    if(!options)
    	options = {};
    
    var mx_record = options.mx;
    var ip_address = options.ip;
    var ip6_address = options.ip6;
    var host_name = system.qwk_id;
    
    for(i=1;i<argc;i++) {
    	switch (argv[i].toLowerCase()) {
    		case "-q":
    			quiet = true;
    			break;
    		case "-mx":
    			mx_record = argv[++i];
    			break;
    		case "-hn":
    			host_name = argv[++i];
    			break;
    		case "-ip6":
    		case "-ipv6":
    			ip6_address = argv[++i];
    			break;
    		default:
    			ip_address = argv[i];
    	}
    }
    
    
    
    for(h in host_list) {
    	sock = new Socket();
    	if( (this.server != undefined) &&
    	    !sock.bind(0,server.interface_ip_address)) {
    		printf("Error %lu binding socket to %s\r\n"
    			,sock.last_error,server.interface_ip_address);
    		continue;
    	}
    	if(!sock.connect(host_list[h],8467)) {
    		sock.close();
    		printf("Error %lu connecting to %s\r\n",sock.last_error,host_list[h]);
    		continue;
    	}
    	var count=0;
    	while(sock.is_connected && count++<10) {
    		str=sock.readline();
    		if(str == null)
    			break;
    		if(!quiet)
    			log(rx_log_level, "RX: " + str);
    		switch(str) {
    			case "id?":
    				writeln(host_name);
    				break;
    			case "pw?":
    				writeln(argv[0]);
    				break;
    			case "ip?":
    				if(ip_address)
    					writeln(ip_address);
    				else
    					writeln("");
    				break;
    			case "ip6?":
    				if(ip6_address)
    					writeln(ip6_address);
    				else
    					writeln("");
    				break;
    			case "mx?":
    				if(mx_record)
    					writeln(mx_record);
    				else
    					writeln("");
    				break;
    			case "txt?":
    				if(options.txt)
    					writeln(options.txt);
    				else
    					writeln(system.name);
    				break;
    			case "loc?":
    				if(options.loc)
    					writeln(options.loc);
    				else
    					writeln("");
    				break;
    			case "wc?":
    				if(options.wildcard)
    					writeln(options.wildcard);
    				else
    					writeln("");
    				break;
    			case "ok":
    				exit(0);
    				break;
    			default:
    				alert("Unexpected message from server: " + str);
    			case "ttl?":
    				writeln("");
    				break;
    		}
    	}
    	break;
    }
    alert("Unexpected termination by server");
    exit(1);