mirror of https://github.com/dirtbags/moth.git
make octopus use a changeable token
This commit is contained in:
parent
7c7fcb2949
commit
29cd09bc70
|
@ -5,6 +5,7 @@ octopus-install: octopus-build
|
|||
|
||||
$(call COPYTREE, packages/octopus/service, $(OCTOPUS_PKGDIR)/service)
|
||||
|
||||
cp packages/octopus/tokens.txt $(OCTOPUS_PKGDIR)/
|
||||
cp packages/octopus/src/octopus $(OCTOPUS_PKGDIR)/bin/
|
||||
|
||||
octopus-clean:
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
IP=$(cat ip.txt)
|
||||
ip addr del $IP dev eth0
|
|
@ -3,6 +3,6 @@
|
|||
exec 2>&1
|
||||
|
||||
IP=$(cat ip.txt)
|
||||
ip addr add $IP dev eth0
|
||||
ip monitor | grep -q $IP
|
||||
exec /opt/octopus/bin/octopus ${IP%/*}
|
||||
ip addr add $IP dev eth0 || true
|
||||
|
||||
exec /opt/octopus/bin/octopus ${IP%/*} < /opt/octopus/tokens.txt
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#define max(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
const char token[] = "octopus:xylep-radar-nanox";
|
||||
const size_t tokenlen = sizeof(token) - 1;
|
||||
const char token[100];
|
||||
size_t tokenlen;
|
||||
|
||||
char const octopus[] =
|
||||
(" ___\n"
|
||||
|
@ -338,6 +338,12 @@ main(int argc, char *argv[])
|
|||
memcpy(&addr, &in6addr_any, sizeof addr);
|
||||
}
|
||||
|
||||
if (NULL == fgets(token, sizeof(token), stdin)) {
|
||||
perror("Unable to read token");
|
||||
return EX_IOERR;
|
||||
}
|
||||
tokenlen = strlen(token);
|
||||
|
||||
bound_ports[0].fd = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
ret = bind_port(&addr, bound_ports[0].fd, 8888);
|
||||
if (-1 == ret) {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
net:xemim-civiz-tyrox
|
Loading…
Reference in New Issue