Amxb_Ubus  3.3.1
Ambiorix Ubus API
forward_ubus_client.sh
Go to the documentation of this file.
1 #!/bin/sh -e
2 
3 if [ $# != 2 ]; then
4  echo "usage: $0 <unix domain socket> <address:port>"
5  echo "example: $0 /var/run/ubus/ubus.sock 192.168.1.1:1971"
6  exit 0
7 fi
8 
9 PRIVATE_SOCKET=$1
10 PUBLIC_IP=$2
11 SOCAT_LOG=/tmp/socat-client-$PUBLIC_IP.log
12 
13 echo "--> socat relay from UNIX domain [$PRIVATE_SOCKET] to socket [$PUBLIC_IP]"
14 echo "--> logs: $SOCAT_LOG"
15 
16 socat -d -d -lf $SOCAT_LOG UNIX-LISTEN:$PRIVATE_SOCKET,fork TCP:$PUBLIC_IP