update ddns client, server and configure file
| | |
| | | |
| | | [common] |
| | | domain="studio.iot-yun.club" |
| | | id="MasterServer" |
| | | domain="master.iot-yun.club" |
| | | |
| | | #[host0] |
| | | #comment="localhost" |
| | |
| | | ip=122.51.234.174 |
| | | port=10001 |
| | | |
| | | [host2] |
| | | comment="aliyun" |
| | | ip=47.74.239.156 |
| | | port=10001 |
| | | #[host2] |
| | | #comment="aliyun" |
| | | #ip=47.74.239.156 |
| | | #port=10001 |
| | | |
| | | |
| | | |
| | |
| | | char *str; |
| | | int val; |
| | | char *domain; |
| | | char *id; |
| | | char *serverip; |
| | | int port; |
| | | int i; |
| | | char key[64]; |
| | | char msg[512]; |
| | | |
| | | struct option long_options[] = { |
| | | {"conf", required_argument, NULL, 'c'}, |
| | |
| | | return -1; |
| | | } |
| | | |
| | | id=iniparser_getstring(ini, "common:id", NULL); |
| | | domain=iniparser_getstring(ini, "common:domain", NULL); |
| | | |
| | | if( !domain ) |
| | | { |
| | | printf("ERROR: cannot parse domain in '%s'\n", conf_file); |
| | | printf("ERROR: cannot parse domain/id in '%s'\n", conf_file); |
| | | return -1; |
| | | } |
| | | |
| | | memset(msg, 0, sizeof(msg)); |
| | | snprintf(msg, sizeof(msg), "[%s]: '%s'", id, domain); |
| | | |
| | | for(i=0; i<MAX_HOSTS; i++) |
| | | { |
| | |
| | | } |
| | | |
| | | printf("==> Start send domain '%s' to [%s:%d]\n", domain, serverip, port); |
| | | socket_send_domain(serverip, port, domain); |
| | | socket_send_domain(serverip, port, msg); |
| | | printf("\n"); |
| | | } |
| | | |
| | |
| | | memset(buf, 0, sizeof(buf));
|
| | | if( (rv=read(clifd, buf, sizeof(buf))) <= 0)
|
| | | {
|
| | | log_err("socket[%d] already get disconncet and will be removed.\n", clifd);
|
| | | log_dbg("socket[%d] already get disconncet and will be removed.\n", clifd);
|
| | | epoll_ctl(epollfd, EPOLL_CTL_DEL, clifd, NULL);
|
| | | close(clifd);
|
| | | continue;
|
| | |
| | | }
|
| | |
|
| | |
|
| | | log_nrml("Domain: %s=>%s\n", buf, ipaddr);
|
| | | log_nrml("<<<<< %s => '%s' >>>>>\n", buf, ipaddr);
|
| | | }
|
| | | }
|
| | | } /* for(i=0; i<rv; i++) */
|