2

我正在尝试为我的 webRTC 应用程序配置一个 coturn 服务器。尽管经过几天试图让它发挥作用,我还是碰壁了。我知道我的 webRTC node.js 应用程序正在使用 turnserver。因为我已经获得了一些免费的turnserver,但它们一直在崩溃,无论如何我都需要自己的。

这是我开始 coturn 时的日志。

    ==== 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.0.2g-fips  1 Mar 2016
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: 192.168.206.115
0: Relay address to use: 192.168.206.115
ERROR: Cannot open log file for writing: /var/log/turnserver/turn_2017-08-07.log
0: log file opened: /var/log/turn_28860_2017-08-07.log
0: Config file found: /etc/turnserver.conf
0: Domain name:
0: Default realm: external.ip
0: SSL23: Certificate file found: /etc/keys/crt.pem
0: SSL23: Private key file found: /etc/keys/key.pem
0: TLS1.0: Certificate file found: /etc/keys/crt.pem
0: TLS1.0: Private key file found: /etc/keys/key.pem
0: TLS1.1: Certificate file found: /etc/keys/crt.pem
0: TLS1.1: Private key file found: /etc/keys/key.pem
0: TLS1.2: Certificate file found: /etc/keys/crt.pem
0: TLS1.2: Private key file found: /etc/keys/key.pem
0: TLS cipher suite: DEFAULT
0: DTLS1.2: Certificate file found: /etc/keys/crt.pem
0: DTLS1.2: Private key file found: /etc/keys/key.pem
0: DTLS: Certificate file found: /etc/keys/crt.pem
0: DTLS: Private key file found: /etc/keys/key.pem
0: DTLS cipher suite: DEFAULT
0: pid file created: /var/run/turnserver.pid
0: IO method (main listener thread): epoll (with changelist)
0: WARNING: I cannot support STUN CHANGE_REQUEST functionality because only one IP address is provided
0: Wait for relay ports initialization...
0:   relay 192.168.206.115 initialization...
0:   relay 192.168.206.115 initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
1: turn server id=1 created
1: IPv4. TLS/SCTP listener opened on : 192.168.206.115:80
1: IPv4. TLS/TCP listener opened on : 192.168.206.115:80
1: IPv4. TLS/SCTP listener opened on : 192.168.206.115:443
1: IPv4. TLS/TCP listener opened on : 192.168.206.115:443
1: IO method (general relay thread): epoll (with changelist)
1: turn server id=0 created
1: IPv4. DTLS/UDP listener opened on: 192.168.206.115:80
1: IPv4. DTLS/UDP listener opened on: 192.168.206.115:443
1: Total General servers: 2
1: IPv4. TLS/TCP listener opened on : 192.168.206.115:80
1: IPv4. TLS/TCP listener opened on : 192.168.206.115:443
1: IO method (admin thread): epoll (with changelist)
1: ERROR: Cannot create CLI listener
1: IO method (auth thread): epoll (with changelist)
1: IO method (auth thread): epoll (with changelist)
1: SQLite DB connection success: /var/lib/turn/turndb
40: IPv4. tcp or tls connected to: 192.168.204.7:56282
40: read_client_connection: HTTP request: GET / HTTP/1.1
Host: 192.168.204.116
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1

这是我尝试将服务器与我的应用程序一起使用时的日志。(更改了外部 ip 值)

    170: IPv4. tcp or tls connected to: 192.168.204.7:56296
170: IPv4. tcp or tls connected to: 192.168.204.7:56298
170: IPv4. tcp or tls connected to: 192.168.204.7:56297
170: IPv4. tcp or tls connected to: 192.168.204.7:56299
170: session 001000000000000002: realm <83.external.ip> user <>: incoming packet message processed, error 401: Unauthorized
170: IPv4. Local relay addr: 192.168.206.115:58700
170: session 001000000000000002: new, realm=<83.external.ip>, username=<karl>, lifetime=3600
170: session 001000000000000002: realm <83.external.ip> user <karl>: incoming packet ALLOCATE processed, success
170: session 000000000000000005: realm <83.external.ip> user <>: incoming packet message processed, error 401: Unauthorized
170: IPv4. Local relay addr: 192.168.206.115:58433
170: session 000000000000000005: new, realm=<83.external.ip>, username=<karl>, lifetime=3600
170: session 000000000000000005: realm <83.external.ip> user <karl>: incoming packet ALLOCATE processed, success
170: session 001000000000000002: refreshed, realm=<83.external.ip>, username=<karl>, lifetime=0
170: session 001000000000000002: realm <83.external.ip> user <karl>: incoming packet REFRESH processed, success
170: session 001000000000000002: TCP socket closed remotely 192.168.204.7:56296
170: session 001000000000000002: closed (2nd stage), user <karl> realm <83.external.ip> origin <>, local 192.168.206.115:80, remote 192.168.204.7:56296, reason: TCP connection closed by client (callback)
170: session 001000000000000002: delete: realm=<83.external.ip>, username=<karl>
170: session 000000000000000005: TCP socket closed remotely 192.168.204.7:56297
170: session 000000000000000005: closed (2nd stage), user <karl> realm <83.external.ip> origin <>, local 192.168.206.115:80, remote 192.168.204.7:56297, reason: TCP connection closed by client (callback)
170: session 000000000000000005: delete: realm=<83.external.ip>, username=<karl>
170: session 001000000000000003: realm <83.external.ip> user <>: incoming packet message processed, error 401: Unauthorized
170: IPv4. Local relay addr: 192.168.206.115:51149
170: session 001000000000000003: new, realm=<83.external.ip>, username=<karl>, lifetime=3600
170: session 001000000000000003: realm <83.external.ip> user <karl>: incoming packet ALLOCATE processed, success
170: session 001000000000000003: peer 192.168.43.161 lifetime updated: 300
170: session 001000000000000003: realm <83.external.ip> user <karl>: incoming packet CREATE_PERMISSION processed, success
170: session 000000000000000006: realm <83.external.ip> user <>: incoming packet message processed, error 401: Unauthorized
170: IPv4. Local relay addr: 192.168.206.115:62354
170: session 000000000000000006: new, realm=<83.external.ip>, username=<karl>, lifetime=3600
170: session 000000000000000006: realm <83.external.ip> user <karl>: incoming packet ALLOCATE processed, success
170: session 001000000000000003: peer 77.218.243.167 lifetime updated: 300
170: session 001000000000000003: realm <83.external.ip> user <karl>: incoming packet CREATE_PERMISSION processed, success

不幸的是,我对网络并不出色。当我坐在几个防火墙后面时,也许这就是为什么它不起作用但我不知道的问题。我很难看出是我的配置问题还是防火墙问题。

This is my .config file. 

    # Run as TURN server only, all STUN requests will be ignored.
no-stun
verbose
# Specify listening port. Change to 80 or 443 to go around some strict NATs.
listening-port=80
tls-listening-port=443

# Specify listening IP, if not set then Coturn listens on all system IPs. 
listening-ip=192.168.206.115
relay-ip=192.168.206.115
external-ip=83.external.ip

# These lines enable support for WebRTC
fingerprint
lt-cred-mech
realm=83.external.ip

# Authentication method
#use-auth-secret
#static-auth-secret=your-auth-secret

cert=/etc/keys/crt.pem
pkey=/etc/keys/key.pem

#total-quota=100000000

# Total bytes-per-second bandwidth the TURN server is allowed to allocate
# for the sessions, combined (input and output network streams are treated separately).
#bps-capacity=100000
#max-bps=100000000000
# This line provides extra security.
stale-nonce

log-file=/var/log/turnserver/turn.log
no-loopback-peers
no-multicast-peers

我尝试了几种不同的配置,但都没有成功。如果您对配置有任何意见,请告知任何内容都会有所帮助。那里缺乏工作的coturns。

我在 turnuserdb.conf 中有一个用户

karl:123

但是如果我打开 use-auth-secret 等,我仍然会得到

17: ERROR: check_stun_auth: Cannot find credentials of user <karl>

在我的日志中。

提前致谢。

4

0 回答 0