微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

cotrun:如何从转弯服务器获取REST API GET响应

如何解决cotrun:如何从转弯服务器获取REST API GET响应

我已经在Ubuntu中安装了Coturn服务器

sudo apt-get -y install coturn

它提供了一些示例,我正在学习其余的api,它具有我正在运行的示例脚本

secure_relay_secret.sh
if [ -d examples ] ; then
       cd examples
fi

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/MysqL/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/lib/:/usr/local/MysqL/lib/

PATH="./bin/:../bin/:../../bin/:${PATH}" turnserver -v --syslog -a -L 127.0.0.1 -L ::1 -E 127.0.0.1 -E ::1 --max-bps=3000000 -f -m 3 --min-port=32355 --max-port=65535 --use-auth-secret --static-auth-secret=logen --realm=north.gov --cert=turn_server_cert.pem --pkey=turn_server_pkey.pem --log-file=stdout -q 100 -Q 300 --cipher-list=ALL $@

控制台显示以下日志

user:/usr/share/coturn/examples/scripts/restapi$ ./secure_relay_secret.sh
0: 
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
Version Coturn-4.5.0.7 'dan Eider'
0: 
Max number of open files/sockets allowed for this process: 65535
0: 
Due to the open files/sockets limitation,max supported number of TURN Sessions possible is: 32500 (approximately)
0: 

==== Show him the instruments,Practical Frost: ====

0: TLS supported
0: DTLS supported
0: DTLS 1.2 supported
0: TURN/STUN ALPN supported
0: Third-party authorization (oAuth) supported
0: GCM (AEAD) supported
0: OpenSSL compile-time version: OpenSSL 1.1.1  11 Sep 2018 (0x1010100f)
0: 
0: sqlite supported,default database location is /var/lib/turn/turndb
0: Redis supported
0: Postgresql supported
0: MysqL supported
0: MongoDB is not supported
0: 
0: Default Net Engine version: 3 (UDP thread per cpu core)

=====================================================

0: Config file found: /etc/turnserver.conf
0: Listener address to use: 127.0.0.1
0: Listener address to use: ::1
0: Relay address to use: 127.0.0.1
0: Relay address to use: ::1
0: 3000000 bytes per second allowed per session
0: Config file found: /etc/turnserver.conf
0: Domain name: 
0: Default realm: north.gov
0: ERROR: 
CONfig ERROR: Empty cli-password,and so telnet cli interface is disabled! Please set a non empty cli-password!
0: WARNING: cannot find certificate file: turn_server_cert.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly
0: WARNING: cannot find private key file: turn_server_pkey.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because private key file is not set properly
Cannot create pid file: /var/run/turnserver.pid: Permission denied
0: Cannot create pid file: /var/run/turnserver.pid
0: pid file created: /var/tmp/turnserver.pid
0: IO method (main listener thread): epoll (with changelist)
0: Wait for relay ports initialization...
0:   relay 127.0.0.1 initialization...
0:   relay 127.0.0.1 initialization done
0:   relay ::1 initialization...
0:   relay ::1 initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=0 created
0: IPv4. SCTP listener opened on : 127.0.0.1:3478
0: IPv4. TCP listener opened on : 127.0.0.1:3478
0: turn server id=1 created
0: IO method (general relay thread): epoll (with changelist)
0: IPv4. SCTP listener opened on : 127.0.0.1:3479
0: IPv4. TCP listener opened on : 127.0.0.1:3479
0: IPv4. TCP listener opened on : 127.0.0.1:3478
0: turn server id=2 created
0: IPv4. TCP listener opened on : 127.0.0.1:3479
0: IPv4. UDP listener opened on: 127.0.0.1:3478
0: IPv6. SCTP listener opened on : ::1:3478
0: IPv6. TCP listener opened on : ::1:3478
0: IPv4. TCP listener opened on : 127.0.0.1:3478
0: IPv6. TCP listener opened on : ::1:3478
0: IPv6. SCTP listener opened on : ::1:3479
0: IPv4. TCP listener opened on : 127.0.0.1:3479
0: IPv4. UDP listener opened on: 127.0.0.1:3479
0: IPv6. TCP listener opened on : ::1:3479
0: IPv6. TCP listener opened on : ::1:3479
0: IPv6. TCP listener opened on : ::1:3478
0: IPv6. TCP listener opened on : ::1:3479
0: IPv6. UDP listener opened on: ::1:3478
0: IPv6. UDP listener opened on: ::1:3479
0: Total General servers: 3
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: sqlite DB connection success: /var/lib/turn/turndb
0: IO method (auth thread): epoll (with changelist)
0: IO method (admin thread): epoll (with changelist)

现在剩下的api docs

请求表明我们需要像这样形成请求

   GET /?service=turn&username=mbzrxpgjys

所以我做了这样的事情

user:~$ curl https://127.0.0.1:3478/?service=turn&username=mbzrxpgjys&key=4080218913

我收到以下答复

[1] 14949
[2] 14950

但是根据文档,它应该返回一个json响应 并在控制台中打印了以下日志

user:~$ curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to 127.0.0.1:3478 

和Coturn日志是

94: IPv4. tcp or tls connected to: 127.0.0.1:38208
154: session 002000000000000001: closed (2nd stage),user <> realm <north.gov> origin <>,local 127.0.0.1:3478,remote 127.0.0.1:38208,reason: allocation watchdog determined stale session state

由于我是初学者,我正在学习阶段,请指导我这里缺少的内容

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。