Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 360 | f9daq | 1 |         location /get_tcpsocket_status { | 
        
| 2 | add_header 'Access-Control-Allow-Origin' '*';  | 
        ||
| 3 | add_header 'Access-Control-Allow-Credentials' 'true';  | 
        ||
| 4 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';  | 
        ||
| 5 | add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';  | 
        ||
| 6 | |||
| 7 | default_type application/json;  | 
        ||
| 8 | |||
| 9 | content_by_lua '  | 
        ||
| 10 |                 local f = io.popen("systemctl is-active redpitaya_tcpsocket.service") | 
        ||
| 11 |                 local content = f:read("*all")  | 
        ||
| 12 | f:close()  | 
        ||
| 13 | ngx.say(content)  | 
        ||
| 14 | ';  | 
        ||
| 15 | }  | 
        ||
| 16 | |||
| 17 |         location /start_tcpsocket_manager { | 
        ||
| 18 | add_header 'Access-Control-Allow-Origin' '*';  | 
        ||
| 19 | add_header 'Access-Control-Allow-Credentials' 'true';  | 
        ||
| 20 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';  | 
        ||
| 21 | add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';  | 
        ||
| 22 | |||
| 23 | default_type application/json;  | 
        ||
| 24 | |||
| 25 | content_by_lua '  | 
        ||
| 26 |                 local f = io.popen("systemctl start redpitaya_tcpsocket.service") | 
        ||
| 27 | f:close()  | 
        ||
| 28 |                 ngx.say("OK")  | 
        ||
| 29 | ';  | 
        ||
| 30 | }  | 
        ||
| 31 | |||
| 32 |         location /stop_tcpsocket_manager { | 
        ||
| 33 | add_header 'Access-Control-Allow-Origin' '*';  | 
        ||
| 34 | add_header 'Access-Control-Allow-Credentials' 'true';  | 
        ||
| 35 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';  | 
        ||
| 36 | add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';  | 
        ||
| 37 | |||
| 38 | default_type application/json;  | 
        ||
| 39 | |||
| 40 | content_by_lua '  | 
        ||
| 41 |                 local f = io.popen("systemctl stop redpitaya_tcpsocket.service") | 
        ||
| 42 | f:close()  | 
        ||
| 43 |                 ngx.say("OK")   | 
        ||
| 44 | ';  | 
        ||
| 45 | }  | 
        ||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 |         location /get_rpip { | 
        ||
| 52 | add_header 'Access-Control-Allow-Origin' '*';  | 
        ||
| 53 | add_header 'Access-Control-Allow-Credentials' 'true';  | 
        ||
| 54 | add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';  | 
        ||
| 55 | add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';  | 
        ||
| 56 | |||
| 57 | default_type application/json;  | 
        ||
| 58 | |||
| 59 | content_by_lua '  | 
        ||
| 60 |                 local eth = io.popen("ip -4 addr list eth0")  | 
        ||
| 61 |                 local wlan = io.popen("ip addr list wlan0wext")  | 
        ||
| 62 |                 local eth_content = eth:read("*all")  | 
        ||
| 63 |                 local wlan_content = wlan:read("*all")  | 
        ||
| 64 | eth:close()  | 
        ||
| 65 | wlan:close()  | 
        ||
| 66 | ngx.say(eth_content..";"..wlan_content)  | 
        ||
| 67 | ';  | 
        ||
| 68 | }  |