Browse Source

hls server: show real client IPs when behind a proxy (#955)

pull/1003/head
aler9 4 years ago
parent
commit
e45820b2c0
  1. 28
      go.mod
  2. 79
      go.sum
  3. 4
      internal/conf/authmethod.go
  4. 1
      internal/conf/conf.go
  5. 4
      internal/conf/credential.go
  6. 4
      internal/conf/encryption.go
  7. 4
      internal/conf/hlsvariant.go
  8. 18
      internal/conf/ipsorcidrs.go
  9. 4
      internal/conf/logdestination.go
  10. 4
      internal/conf/loglevel.go
  11. 4
      internal/conf/path.go
  12. 4
      internal/conf/protocol.go
  13. 4
      internal/conf/sourceprotocol.go
  14. 4
      internal/conf/stringduration.go
  15. 4
      internal/conf/stringsize.go
  16. 6
      internal/core/api.go
  17. 2
      internal/core/core.go
  18. 16
      internal/core/hls_muxer.go
  19. 17
      internal/core/hls_server.go
  20. 3
      internal/core/ip.go
  21. 1
      internal/core/metrics.go
  22. 2
      internal/core/path.go
  23. 6
      internal/core/rtmp_conn.go
  24. 4
      internal/core/rtsp_conn.go
  25. 4
      internal/core/rtsp_session.go
  26. 4
      rtsp-simple-server.yml

28
go.mod

@ -8,7 +8,7 @@ require (
github.com/aler9/gortsplib v0.0.0-20220614133216-aa08f973ddb8 github.com/aler9/gortsplib v0.0.0-20220614133216-aa08f973ddb8
github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757 github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757
github.com/fsnotify/fsnotify v1.4.9 github.com/fsnotify/fsnotify v1.4.9
github.com/gin-gonic/gin v1.7.2 github.com/gin-gonic/gin v1.8.1
github.com/gookit/color v1.4.2 github.com/gookit/color v1.4.2
github.com/grafov/m3u8 v0.11.1 github.com/grafov/m3u8 v0.11.1
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
@ -16,7 +16,7 @@ require (
github.com/orcaman/writerseeker v0.0.0 github.com/orcaman/writerseeker v0.0.0
github.com/pion/rtp v1.7.13 github.com/pion/rtp v1.7.13
github.com/stretchr/testify v1.7.1 github.com/stretchr/testify v1.7.1
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )
@ -27,27 +27,29 @@ require (
github.com/asticode/go-astikit v0.20.0 // indirect github.com/asticode/go-astikit v0.20.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect github.com/goccy/go-json v0.9.7 // indirect
github.com/google/uuid v1.1.2 // indirect github.com/google/uuid v1.1.2 // indirect
github.com/icza/bitio v1.1.0 // indirect github.com/icza/bitio v1.1.0 // indirect
github.com/json-iterator/go v1.1.9 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.0 // indirect github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pion/randutil v0.1.0 // indirect github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.9 // indirect github.com/pion/rtcp v1.2.9 // indirect
github.com/pion/sdp/v3 v3.0.5 // indirect github.com/pion/sdp/v3 v3.0.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect github.com/ugorji/go/codec v1.2.7 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
golang.org/x/net v0.0.0-20220526153639-5463443f8c37 // indirect golang.org/x/net v0.0.0-20220526153639-5463443f8c37 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
google.golang.org/protobuf v1.26.0 // indirect golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
) )
replace github.com/notedit/rtmp => github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927 replace github.com/notedit/rtmp => github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927

79
go.sum

@ -18,6 +18,7 @@ github.com/asticode/go-astits v1.10.0/go.mod h1:DkOWmBNQpnr9mv24KfZjq4JawCFX1FCq
github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757 h1:mmwJPTHZbtBZQs9OOIQcN9K+TXaIDy0TVvbdtTzqVF0= github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757 h1:mmwJPTHZbtBZQs9OOIQcN9K+TXaIDy0TVvbdtTzqVF0=
github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757/go.mod h1:DkOWmBNQpnr9mv24KfZjq4JawCFX1FCqjLVGvO0DygQ= github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757/go.mod h1:DkOWmBNQpnr9mv24KfZjq4JawCFX1FCqjLVGvO0DygQ=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -26,19 +27,20 @@ github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.2 h1:Tg03T9yM2xa8j6I3Z3oqLaQRSmKvxPd6g/2HJ6zICFA= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
github.com/gin-gonic/gin v1.7.2/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.10.0 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM=
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
@ -46,7 +48,6 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@ -65,24 +66,27 @@ github.com/icza/bitio v1.1.0 h1:ysX4vtldjdi3Ygai5m1cWy4oLkhWTAi+SyO6HC8L9T0=
github.com/icza/bitio v1.1.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= github.com/icza/bitio v1.1.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k=
github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
@ -94,6 +98,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c= github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c=
github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA=
github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8=
github.com/pion/rtcp v1.2.9 h1:1ujStwg++IOLIEoOiIQ2s+qBuJ1VN81KW+9pMPsif+U= github.com/pion/rtcp v1.2.9 h1:1ujStwg++IOLIEoOiIQ2s+qBuJ1VN81KW+9pMPsif+U=
@ -102,9 +108,13 @@ github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA=
github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
github.com/pion/sdp/v3 v3.0.5 h1:ouvI7IgGl+V4CrqskVtr3AaTrPvPisEOxwgpdktctkU= github.com/pion/sdp/v3 v3.0.5 h1:ouvI7IgGl+V4CrqskVtr3AaTrPvPisEOxwgpdktctkU=
github.com/pion/sdp/v3 v3.0.5/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= github.com/pion/sdp/v3 v3.0.5/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/profile v1.4.0/go.mod h1:NWz/XGvpEW1FyYQ7fCx4dqYBLlfTcE+A9FLAkNKqjFE= github.com/pkg/profile v1.4.0/go.mod h1:NWz/XGvpEW1FyYQ7fCx4dqYBLlfTcE+A9FLAkNKqjFE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
@ -114,24 +124,25 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/sunfish-shogi/bufseekio v0.0.0-20210207115823-a4185644b365/go.mod h1:dEzdXgvImkQ3WLI+0KQpmEx8T/C/ma9KeS3AfmU899I= github.com/sunfish-shogi/bufseekio v0.0.0-20210207115823-a4185644b365/go.mod h1:dEzdXgvImkQ3WLI+0KQpmEx8T/C/ma9KeS3AfmU899I=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20220526153639-5463443f8c37 h1:lUkvobShwKsOesNfWWlCS5q7fnbG1MEliIzwu886fn8= golang.org/x/net v0.0.0-20220526153639-5463443f8c37 h1:lUkvobShwKsOesNfWWlCS5q7fnbG1MEliIzwu886fn8=
golang.org/x/net v0.0.0-20220526153639-5463443f8c37/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220526153639-5463443f8c37/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
@ -144,9 +155,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -154,13 +163,13 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
@ -180,13 +189,16 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg= gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg=
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98=
@ -198,5 +210,6 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

4
internal/conf/authmethod.go

@ -12,7 +12,7 @@ import (
// AuthMethods is the authMethods parameter. // AuthMethods is the authMethods parameter.
type AuthMethods []headers.AuthMethod type AuthMethods []headers.AuthMethod
// MarshalJSON marshals a AuthMethods into JSON. // MarshalJSON implements json.Marshaler.
func (d AuthMethods) MarshalJSON() ([]byte, error) { func (d AuthMethods) MarshalJSON() ([]byte, error) {
out := make([]string, len(d)) out := make([]string, len(d))
@ -31,7 +31,7 @@ func (d AuthMethods) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a AuthMethods from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *AuthMethods) UnmarshalJSON(b []byte) error { func (d *AuthMethods) UnmarshalJSON(b []byte) error {
var in []string var in []string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

1
internal/conf/conf.go

@ -216,6 +216,7 @@ type Conf struct {
HLSEncryption bool `json:"hlsEncryption"` HLSEncryption bool `json:"hlsEncryption"`
HLSServerKey string `json:"hlsServerKey"` HLSServerKey string `json:"hlsServerKey"`
HLSServerCert string `json:"hlsServerCert"` HLSServerCert string `json:"hlsServerCert"`
HLSTrustedProxies IPsOrCIDRs `json:"hlsTrustedProxies"`
// paths // paths
Paths map[string]*PathConf `json:"paths"` Paths map[string]*PathConf `json:"paths"`

4
internal/conf/credential.go

@ -14,12 +14,12 @@ const credentialSupportedChars = "A-Z,0-9,!,$,(,),*,+,.,;,<,=,>,[,],^,_,-,{,}"
// Credential is a parameter that is used as username or password. // Credential is a parameter that is used as username or password.
type Credential string type Credential string
// MarshalJSON marshals a Credential into JSON. // MarshalJSON implements json.Marshaler.
func (d Credential) MarshalJSON() ([]byte, error) { func (d Credential) MarshalJSON() ([]byte, error) {
return json.Marshal(string(d)) return json.Marshal(string(d))
} }
// UnmarshalJSON unmarshals a Credential from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *Credential) UnmarshalJSON(b []byte) error { func (d *Credential) UnmarshalJSON(b []byte) error {
var in string var in string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

4
internal/conf/encryption.go

@ -15,7 +15,7 @@ const (
EncryptionStrict EncryptionStrict
) )
// MarshalJSON marshals a Encryption into JSON. // MarshalJSON implements json.Marshaler.
func (d Encryption) MarshalJSON() ([]byte, error) { func (d Encryption) MarshalJSON() ([]byte, error) {
var out string var out string
@ -33,7 +33,7 @@ func (d Encryption) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a Encryption from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *Encryption) UnmarshalJSON(b []byte) error { func (d *Encryption) UnmarshalJSON(b []byte) error {
var in string var in string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

4
internal/conf/hlsvariant.go

@ -17,7 +17,7 @@ const (
HLSVariantLowLatency HLSVariant = HLSVariant(hls.MuxerVariantLowLatency) HLSVariantLowLatency HLSVariant = HLSVariant(hls.MuxerVariantLowLatency)
) )
// MarshalJSON marshals a HLSVariant into JSON. // MarshalJSON implements json.Marshaler.
func (d HLSVariant) MarshalJSON() ([]byte, error) { func (d HLSVariant) MarshalJSON() ([]byte, error) {
var out string var out string
@ -35,7 +35,7 @@ func (d HLSVariant) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a HLSVariant from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *HLSVariant) UnmarshalJSON(b []byte) error { func (d *HLSVariant) UnmarshalJSON(b []byte) error {
var in string var in string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

18
internal/conf/ipsornets.go → internal/conf/ipsorcidrs.go

@ -8,15 +8,15 @@ import (
"strings" "strings"
) )
// IPsOrNets is a parameter that acceps IPs or subnets. // IPsOrCIDRs is a parameter that contains a list of IPs or CIDRs.
type IPsOrNets []interface{} type IPsOrCIDRs []fmt.Stringer
// MarshalJSON marshals a IPsOrNets into JSON. // MarshalJSON implements json.Marshaler.
func (d IPsOrNets) MarshalJSON() ([]byte, error) { func (d IPsOrCIDRs) MarshalJSON() ([]byte, error) {
out := make([]string, len(d)) out := make([]string, len(d))
for i, v := range d { for i, v := range d {
out[i] = v.(fmt.Stringer).String() out[i] = v.String()
} }
sort.Strings(out) sort.Strings(out)
@ -24,8 +24,8 @@ func (d IPsOrNets) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a IPsOrNets from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *IPsOrNets) UnmarshalJSON(b []byte) error { func (d *IPsOrCIDRs) UnmarshalJSON(b []byte) error {
var in []string var in []string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {
return err return err
@ -41,14 +41,14 @@ func (d *IPsOrNets) UnmarshalJSON(b []byte) error {
} else if ip := net.ParseIP(t); ip != nil { } else if ip := net.ParseIP(t); ip != nil {
*d = append(*d, ip) *d = append(*d, ip)
} else { } else {
return fmt.Errorf("unable to parse ip/network '%s'", t) return fmt.Errorf("unable to parse IP/CIDR '%s'", t)
} }
} }
return nil return nil
} }
func (d *IPsOrNets) unmarshalEnv(s string) error { func (d *IPsOrCIDRs) unmarshalEnv(s string) error {
byts, _ := json.Marshal(strings.Split(s, ",")) byts, _ := json.Marshal(strings.Split(s, ","))
return d.UnmarshalJSON(byts) return d.UnmarshalJSON(byts)
} }

4
internal/conf/logdestination.go

@ -12,7 +12,7 @@ import (
// LogDestinations is the logDestionations parameter. // LogDestinations is the logDestionations parameter.
type LogDestinations map[logger.Destination]struct{} type LogDestinations map[logger.Destination]struct{}
// MarshalJSON marshals a LogDestinations into JSON. // MarshalJSON implements json.Marshaler.
func (d LogDestinations) MarshalJSON() ([]byte, error) { func (d LogDestinations) MarshalJSON() ([]byte, error) {
out := make([]string, len(d)) out := make([]string, len(d))
i := 0 i := 0
@ -40,7 +40,7 @@ func (d LogDestinations) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a LogDestinations from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *LogDestinations) UnmarshalJSON(b []byte) error { func (d *LogDestinations) UnmarshalJSON(b []byte) error {
var in []string var in []string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

4
internal/conf/loglevel.go

@ -10,7 +10,7 @@ import (
// LogLevel is the logLevel parameter. // LogLevel is the logLevel parameter.
type LogLevel logger.Level type LogLevel logger.Level
// MarshalJSON marshals a LogLevel into JSON. // MarshalJSON implements json.Marshaler.
func (d LogLevel) MarshalJSON() ([]byte, error) { func (d LogLevel) MarshalJSON() ([]byte, error) {
var out string var out string
@ -31,7 +31,7 @@ func (d LogLevel) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a LogLevel from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *LogLevel) UnmarshalJSON(b []byte) error { func (d *LogLevel) UnmarshalJSON(b []byte) error {
var in string var in string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

4
internal/conf/path.go

@ -53,10 +53,10 @@ type PathConf struct {
// authentication // authentication
PublishUser Credential `json:"publishUser"` PublishUser Credential `json:"publishUser"`
PublishPass Credential `json:"publishPass"` PublishPass Credential `json:"publishPass"`
PublishIPs IPsOrNets `json:"publishIPs"` PublishIPs IPsOrCIDRs `json:"publishIPs"`
ReadUser Credential `json:"readUser"` ReadUser Credential `json:"readUser"`
ReadPass Credential `json:"readPass"` ReadPass Credential `json:"readPass"`
ReadIPs IPsOrNets `json:"readIPs"` ReadIPs IPsOrCIDRs `json:"readIPs"`
// external commands // external commands
RunOnInit string `json:"runOnInit"` RunOnInit string `json:"runOnInit"`

4
internal/conf/protocol.go

@ -15,7 +15,7 @@ type Protocol gortsplib.Transport
// Protocols is the protocols parameter. // Protocols is the protocols parameter.
type Protocols map[Protocol]struct{} type Protocols map[Protocol]struct{}
// MarshalJSON marshals a Protocols into JSON. // MarshalJSON implements json.Marshaler.
func (d Protocols) MarshalJSON() ([]byte, error) { func (d Protocols) MarshalJSON() ([]byte, error) {
out := make([]string, len(d)) out := make([]string, len(d))
i := 0 i := 0
@ -43,7 +43,7 @@ func (d Protocols) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a Protocols from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *Protocols) UnmarshalJSON(b []byte) error { func (d *Protocols) UnmarshalJSON(b []byte) error {
var in []string var in []string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

4
internal/conf/sourceprotocol.go

@ -12,7 +12,7 @@ type SourceProtocol struct {
*gortsplib.Transport *gortsplib.Transport
} }
// MarshalJSON marshals a SourceProtocol into JSON. // MarshalJSON implements json.Marshaler.
func (d SourceProtocol) MarshalJSON() ([]byte, error) { func (d SourceProtocol) MarshalJSON() ([]byte, error) {
var out string var out string
@ -34,7 +34,7 @@ func (d SourceProtocol) MarshalJSON() ([]byte, error) {
return json.Marshal(out) return json.Marshal(out)
} }
// UnmarshalJSON unmarshals a SourceProtocol from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *SourceProtocol) UnmarshalJSON(b []byte) error { func (d *SourceProtocol) UnmarshalJSON(b []byte) error {
var in string var in string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

4
internal/conf/stringduration.go

@ -9,12 +9,12 @@ import (
// Durations are normally unmarshaled from numbers. // Durations are normally unmarshaled from numbers.
type StringDuration time.Duration type StringDuration time.Duration
// MarshalJSON marshals a StringDuration into JSON. // MarshalJSON implements json.Marshaler.
func (d StringDuration) MarshalJSON() ([]byte, error) { func (d StringDuration) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Duration(d).String()) return json.Marshal(time.Duration(d).String())
} }
// UnmarshalJSON unmarshals a StringDuration from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (d *StringDuration) UnmarshalJSON(b []byte) error { func (d *StringDuration) UnmarshalJSON(b []byte) error {
var in string var in string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

4
internal/conf/stringsize.go

@ -9,12 +9,12 @@ import (
// StringSize is a size that is unmarshaled from a string. // StringSize is a size that is unmarshaled from a string.
type StringSize uint64 type StringSize uint64
// MarshalJSON marshals a StringSize into JSON. // MarshalJSON implements json.Marshaler.
func (s StringSize) MarshalJSON() ([]byte, error) { func (s StringSize) MarshalJSON() ([]byte, error) {
return []byte(`"` + bytefmt.ByteSize(uint64(s)) + `"`), nil return []byte(`"` + bytefmt.ByteSize(uint64(s)) + `"`), nil
} }
// UnmarshalJSON unmarshals a StringSize from JSON. // UnmarshalJSON implements json.Unmarshaler.
func (s *StringSize) UnmarshalJSON(b []byte) error { func (s *StringSize) UnmarshalJSON(b []byte) error {
var in string var in string
if err := json.Unmarshal(b, &in); err != nil { if err := json.Unmarshal(b, &in); err != nil {

6
internal/core/api.go

@ -92,6 +92,7 @@ func loadConfData(ctx *gin.Context) (interface{}, error) {
HLSEncryption *bool `json:"hlsEncryption"` HLSEncryption *bool `json:"hlsEncryption"`
HLSServerKey *string `json:"hlsServerKey"` HLSServerKey *string `json:"hlsServerKey"`
HLSServerCert *string `json:"hlsServerCert"` HLSServerCert *string `json:"hlsServerCert"`
HLSTrustedProxies *conf.IPsOrCIDRs `json:"hlsTrustedProxies"`
} }
err := json.NewDecoder(ctx.Request.Body).Decode(&in) err := json.NewDecoder(ctx.Request.Body).Decode(&in)
if err != nil { if err != nil {
@ -118,10 +119,10 @@ func loadConfPathData(ctx *gin.Context) (interface{}, error) {
// authentication // authentication
PublishUser *conf.Credential `json:"publishUser"` PublishUser *conf.Credential `json:"publishUser"`
PublishPass *conf.Credential `json:"publishPass"` PublishPass *conf.Credential `json:"publishPass"`
PublishIPs *conf.IPsOrNets `json:"publishIPs"` PublishIPs *conf.IPsOrCIDRs `json:"publishIPs"`
ReadUser *conf.Credential `json:"readUser"` ReadUser *conf.Credential `json:"readUser"`
ReadPass *conf.Credential `json:"readPass"` ReadPass *conf.Credential `json:"readPass"`
ReadIPs *conf.IPsOrNets `json:"readIPs"` ReadIPs *conf.IPsOrCIDRs `json:"readIPs"`
// external commands // external commands
RunOnInit *string `json:"runOnInit"` RunOnInit *string `json:"runOnInit"`
@ -205,6 +206,7 @@ func newAPI(
} }
router := gin.New() router := gin.New()
router.SetTrustedProxies(nil)
router.NoRoute(a.mwLog) router.NoRoute(a.mwLog)
group := router.Group("/", a.mwLog) group := router.Group("/", a.mwLog)

2
internal/core/core.go

@ -342,6 +342,7 @@ func (p *Core) createResources(initial bool) error {
p.conf.HLSEncryption, p.conf.HLSEncryption,
p.conf.HLSServerKey, p.conf.HLSServerKey,
p.conf.HLSServerCert, p.conf.HLSServerCert,
p.conf.HLSTrustedProxies,
p.conf.ReadBufferCount, p.conf.ReadBufferCount,
p.pathManager, p.pathManager,
p.metrics, p.metrics,
@ -490,6 +491,7 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
newConf.HLSEncryption != p.conf.HLSEncryption || newConf.HLSEncryption != p.conf.HLSEncryption ||
newConf.HLSServerKey != p.conf.HLSServerKey || newConf.HLSServerKey != p.conf.HLSServerKey ||
newConf.HLSServerCert != p.conf.HLSServerCert || newConf.HLSServerCert != p.conf.HLSServerCert ||
!reflect.DeepEqual(newConf.HLSTrustedProxies, p.conf.HLSTrustedProxies) ||
newConf.ReadBufferCount != p.conf.ReadBufferCount || newConf.ReadBufferCount != p.conf.ReadBufferCount ||
closePathManager || closePathManager ||
closeMetrics { closeMetrics {

16
internal/core/hls_muxer.go

@ -417,7 +417,7 @@ func (m *hlsMuxer) runInner(innerCtx context.Context, innerReady chan struct{})
func (m *hlsMuxer) handleRequest(req *hlsMuxerRequest) func() *hls.MuxerFileResponse { func (m *hlsMuxer) handleRequest(req *hlsMuxerRequest) func() *hls.MuxerFileResponse {
atomic.StoreInt64(m.lastRequestTime, time.Now().Unix()) atomic.StoreInt64(m.lastRequestTime, time.Now().Unix())
err := m.authenticate(req.ctx.Request) err := m.authenticate(req.ctx)
if err != nil { if err != nil {
if terr, ok := err.(pathErrAuthCritical); ok { if terr, ok := err.(pathErrAuthCritical); ok {
m.log(logger.Info, "authentication error: %s", terr.message) m.log(logger.Info, "authentication error: %s", terr.message)
@ -459,16 +459,15 @@ func (m *hlsMuxer) handleRequest(req *hlsMuxerRequest) func() *hls.MuxerFileResp
} }
} }
func (m *hlsMuxer) authenticate(req *http.Request) error { func (m *hlsMuxer) authenticate(ctx *gin.Context) error {
pathConf := m.path.Conf() pathConf := m.path.Conf()
pathIPs := pathConf.ReadIPs pathIPs := pathConf.ReadIPs
pathUser := pathConf.ReadUser pathUser := pathConf.ReadUser
pathPass := pathConf.ReadPass pathPass := pathConf.ReadPass
if m.externalAuthenticationURL != "" { if m.externalAuthenticationURL != "" {
tmp, _, _ := net.SplitHostPort(req.RemoteAddr) ip := net.ParseIP(ctx.ClientIP())
ip := net.ParseIP(tmp) user, pass, _ := ctx.Request.BasicAuth()
user, pass, _ := req.BasicAuth()
err := externalAuth( err := externalAuth(
m.externalAuthenticationURL, m.externalAuthenticationURL,
@ -477,7 +476,7 @@ func (m *hlsMuxer) authenticate(req *http.Request) error {
pass, pass,
m.pathName, m.pathName,
"read", "read",
req.URL.RawQuery) ctx.Request.URL.RawQuery)
if err != nil { if err != nil {
return pathErrAuthCritical{ return pathErrAuthCritical{
message: fmt.Sprintf("external authentication failed: %s", err), message: fmt.Sprintf("external authentication failed: %s", err),
@ -486,8 +485,7 @@ func (m *hlsMuxer) authenticate(req *http.Request) error {
} }
if pathIPs != nil { if pathIPs != nil {
tmp, _, _ := net.SplitHostPort(req.RemoteAddr) ip := net.ParseIP(ctx.ClientIP())
ip := net.ParseIP(tmp)
if !ipEqualOrInRange(ip, pathIPs) { if !ipEqualOrInRange(ip, pathIPs) {
return pathErrAuthCritical{ return pathErrAuthCritical{
@ -497,7 +495,7 @@ func (m *hlsMuxer) authenticate(req *http.Request) error {
} }
if pathUser != "" { if pathUser != "" {
user, pass, ok := req.BasicAuth() user, pass, ok := ctx.Request.BasicAuth()
if !ok { if !ok {
return pathErrAuthNotCritical{} return pathErrAuthNotCritical{}
} }

17
internal/core/hls_server.go

@ -62,6 +62,7 @@ type hlsServer struct {
hlsPartDuration conf.StringDuration hlsPartDuration conf.StringDuration
hlsSegmentMaxSize conf.StringSize hlsSegmentMaxSize conf.StringSize
hlsAllowOrigin string hlsAllowOrigin string
hlsTrustedProxies conf.IPsOrCIDRs
readBufferCount int readBufferCount int
pathManager *pathManager pathManager *pathManager
metrics *metrics metrics *metrics
@ -95,6 +96,7 @@ func newHLSServer(
hlsEncryption bool, hlsEncryption bool,
hlsServerKey string, hlsServerKey string,
hlsServerCert string, hlsServerCert string,
hlsTrustedProxies conf.IPsOrCIDRs,
readBufferCount int, readBufferCount int,
pathManager *pathManager, pathManager *pathManager,
metrics *metrics, metrics *metrics,
@ -129,6 +131,7 @@ func newHLSServer(
hlsPartDuration: hlsPartDuration, hlsPartDuration: hlsPartDuration,
hlsSegmentMaxSize: hlsSegmentMaxSize, hlsSegmentMaxSize: hlsSegmentMaxSize,
hlsAllowOrigin: hlsAllowOrigin, hlsAllowOrigin: hlsAllowOrigin,
hlsTrustedProxies: hlsTrustedProxies,
readBufferCount: readBufferCount, readBufferCount: readBufferCount,
pathManager: pathManager, pathManager: pathManager,
parent: parent, parent: parent,
@ -175,6 +178,12 @@ func (s *hlsServer) run() {
router := gin.New() router := gin.New()
router.NoRoute(s.onRequest) router.NoRoute(s.onRequest)
tmp := make([]string, len(s.hlsTrustedProxies))
for i, entry := range s.hlsTrustedProxies {
tmp[i] = entry.String()
}
router.SetTrustedProxies(tmp)
hs := &http.Server{ hs := &http.Server{
Handler: router, Handler: router,
TLSConfig: s.tlsConfig, TLSConfig: s.tlsConfig,
@ -196,7 +205,7 @@ outer:
} }
case req := <-s.request: case req := <-s.request:
s.findOrCreateMuxer(req.dir, req.ctx.Request.RemoteAddr, req) s.findOrCreateMuxer(req.dir, req.ctx.ClientIP(), req)
case c := <-s.muxerClose: case c := <-s.muxerClose:
if c2, ok := s.muxers[c.PathName()]; !ok || c2 != c { if c2, ok := s.muxers[c.PathName()]; !ok || c2 != c {
@ -232,10 +241,10 @@ outer:
} }
func (s *hlsServer) onRequest(ctx *gin.Context) { func (s *hlsServer) onRequest(ctx *gin.Context) {
s.log(logger.Debug, "[conn %v] %s %s", ctx.Request.RemoteAddr, ctx.Request.Method, ctx.Request.URL.Path) s.log(logger.Debug, "[conn %v] %s %s", ctx.ClientIP(), ctx.Request.Method, ctx.Request.URL.Path)
byts, _ := httputil.DumpRequest(ctx.Request, true) byts, _ := httputil.DumpRequest(ctx.Request, true)
s.log(logger.Debug, "[conn %v] [c->s] %s", ctx.Request.RemoteAddr, string(byts)) s.log(logger.Debug, "[conn %v] [c->s] %s", ctx.ClientIP(), string(byts))
logw := &httpLogWriter{ResponseWriter: ctx.Writer} logw := &httpLogWriter{ResponseWriter: ctx.Writer}
ctx.Writer = logw ctx.Writer = logw
@ -311,7 +320,7 @@ func (s *hlsServer) onRequest(ctx *gin.Context) {
case <-s.ctx.Done(): case <-s.ctx.Done():
} }
s.log(logger.Debug, "[conn %v] [s->c] %s", ctx.Request.RemoteAddr, logw.dump()) s.log(logger.Debug, "[conn %v] [s->c] %s", ctx.ClientIP(), logw.dump())
} }
func (s *hlsServer) findOrCreateMuxer(pathName string, remoteAddr string, req *hlsMuxerRequest) *hlsMuxer { func (s *hlsServer) findOrCreateMuxer(pathName string, remoteAddr string, req *hlsMuxerRequest) *hlsMuxer {

3
internal/core/ip.go

@ -1,10 +1,11 @@
package core package core
import ( import (
"fmt"
"net" "net"
) )
func ipEqualOrInRange(ip net.IP, ips []interface{}) bool { func ipEqualOrInRange(ip net.IP, ips []fmt.Stringer) bool {
for _, item := range ips { for _, item := range ips {
switch titem := item.(type) { switch titem := item.(type) {
case net.IP: case net.IP:

1
internal/core/metrics.go

@ -65,6 +65,7 @@ func newMetrics(
} }
router := gin.New() router := gin.New()
router.SetTrustedProxies(nil)
router.GET("/metrics", m.onMetrics) router.GET("/metrics", m.onMetrics)
m.server = &http.Server{Handler: router} m.server = &http.Server{Handler: router}

2
internal/core/path.go

@ -25,7 +25,7 @@ func newEmptyTimer() *time.Timer {
} }
type authenticateFunc func( type authenticateFunc func(
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
) error ) error

6
internal/core/rtmp_conn.go

@ -227,7 +227,7 @@ func (c *rtmpConn) runRead(ctx context.Context) error {
author: c, author: c,
pathName: pathName, pathName: pathName,
authenticate: func( authenticate: func(
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
) error { ) error {
@ -517,7 +517,7 @@ func (c *rtmpConn) runPublish(ctx context.Context) error {
author: c, author: c,
pathName: pathName, pathName: pathName,
authenticate: func( authenticate: func(
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
) error { ) error {
@ -678,7 +678,7 @@ func (c *rtmpConn) runPublish(ctx context.Context) error {
func (c *rtmpConn) authenticate( func (c *rtmpConn) authenticate(
pathName string, pathName string,
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
action string, action string,

4
internal/core/rtsp_conn.go

@ -104,7 +104,7 @@ func (c *rtspConn) ip() net.IP {
func (c *rtspConn) authenticate( func (c *rtspConn) authenticate(
pathName string, pathName string,
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
action string, action string,
@ -247,7 +247,7 @@ func (c *rtspConn) onDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx,
pathName: ctx.Path, pathName: ctx.Path,
url: ctx.Request.URL, url: ctx.Request.URL,
authenticate: func( authenticate: func(
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
) error { ) error {

4
internal/core/rtsp_session.go

@ -129,7 +129,7 @@ func (s *rtspSession) onAnnounce(c *rtspConn, ctx *gortsplib.ServerHandlerOnAnno
author: s, author: s,
pathName: ctx.Path, pathName: ctx.Path,
authenticate: func( authenticate: func(
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
) error { ) error {
@ -189,7 +189,7 @@ func (s *rtspSession) onSetup(c *rtspConn, ctx *gortsplib.ServerHandlerOnSetupCt
author: s, author: s,
pathName: ctx.Path, pathName: ctx.Path,
authenticate: func( authenticate: func(
pathIPs []interface{}, pathIPs []fmt.Stringer,
pathUser conf.Credential, pathUser conf.Credential,
pathPass conf.Credential, pathPass conf.Credential,
) error { ) error {

4
rtsp-simple-server.yml

@ -149,6 +149,10 @@ hlsEncryption: no
hlsServerKey: server.key hlsServerKey: server.key
# Path to the server certificate. # Path to the server certificate.
hlsServerCert: server.crt hlsServerCert: server.crt
# List of IPs or CIDRs of proxies behind the HLS server.
# If the server receives a request from one of these entries, IP in logs
# will be taken from the X-Forwarded-For header.
hlsTrustedProxies: []
############################################### ###############################################
# Path parameters # Path parameters

Loading…
Cancel
Save