pion / turn

Pion TURN, an API for building TURN clients and servers
MIT License
1.86k stars 317 forks source link

Support stand alone STUN server mode #380

Closed boks1971 closed 7 months ago

boks1971 commented 7 months ago

Description

Running in stand alone STUN server does not start due to packet conn config requiring relay address config during validation.

To enable that mode, bypass validation if relay address config in packet conn config is nil.

Note that it is still validated in ListenerConfig.

codecov[bot] commented 7 months ago

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 66.72%. Comparing base (40c468b) to head (bf5dd40). Report is 1 commits behind head on master.

:exclamation: Current head bf5dd40 differs from pull request most recent head 57c4727. Consider uploading reports for the commit 57c4727 to get more accurate results

Files Patch % Lines
server_config.go 40.00% 2 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #380 +/- ## =========================================== + Coverage 27.04% 66.72% +39.68% =========================================== Files 43 43 Lines 2888 2891 +3 =========================================== + Hits 781 1929 +1148 + Misses 2062 796 -1266 - Partials 45 166 +121 ``` | [Flag](https://app.codecov.io/gh/pion/turn/pull/380/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [go](https://app.codecov.io/gh/pion/turn/pull/380/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `66.72% <57.14%> (?)` | | | [wasm](https://app.codecov.io/gh/pion/turn/pull/380/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `27.01% <0.00%> (-0.03%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

boks1971 commented 7 months ago

@Sean-Der Not sure what is causing the test failures. I am unable to run tests locally also. Locally it fails on listening on 127.0.0.133

Running locally, I get the following failures

    server_test.go:311: 
            Error Trace:    /Users/raja/ws/lk/turn/server_test.go:311
            Error:          Received unexpected error:
                            listen udp4 127.0.0.133:54321: bind: can't assign requested address
            Test:           TestServer/Filter_on_client_address_and_peer_IP
    server_test.go:322: 
            Error Trace:    /Users/raja/ws/lk/turn/server_test.go:322
            Error:          Received unexpected error:
                            turn: conn cannot not be nil
            Test:           TestServer/Filter_on_client_address_and_peer_IP

And this panic

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10503afd8]

goroutine 100 [running]:
testing.tRunner.func1.2({0x1050dc9a0, 0x10527e3d0})
    /opt/homebrew/opt/go/libexec/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
    /opt/homebrew/opt/go/libexec/src/testing/testing.go:1634 +0x33c
panic({0x1050dc9a0?, 0x10527e3d0?})
    /opt/homebrew/opt/go/libexec/src/runtime/panic.go:770 +0x124
github.com/pion/turn/v3.(*Client).Listen(0x10511e628?)
    /Users/raja/ws/lk/turn/client.go:168 +0x18
github.com/pion/turn/v3.TestServer.func5(0x14000132000)
    /Users/raja/ws/lk/turn/server_test.go:323 +0xc00
testing.tRunner(0x14000132000, 0x1400000e090)
    /opt/homebrew/opt/go/libexec/src/testing/testing.go:1689 +0xec
created by testing.(*T).Run in goroutine 66
    /opt/homebrew/opt/go/libexec/src/testing/testing.go:1742 +0x318

And these failures happen before my changes too.

CI is failing at a different spot.

Can you please have a look when you get a chance and advise?

Sean-Der commented 7 months ago

Will do @boks1971 ! Will figure out CI and merge today