diff --git a/.clippy.toml b/.clippy.toml index 3d6b6c5d3..0bac1693a 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -8,7 +8,7 @@ doc-valid-idents = [ "IPv4", "IPv6", "JavaScript", "NaN", "NaNs", "OAuth", "OpenGL", "OpenSSH", "OpenSSL", "OpenStreetMap", "TrueType", "iOS", "macOS", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", - "WebSocket", + "WebRTC", "WebSocket", "MediaStream", "MediaStreamConstraints", "MediaStreamTrack", "RTCConfiguration", "RTCIceCandidate", "RTCIceServer", "RTCPeerConnection", "RTCPeerConnectionIceEvent", diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..d3cb9f7b4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,116 @@ +language: rust + +cache: cargo + +install: + - rustc -vV + - cargo -vV + +jobs: + allow_failures: + - rust: nightly + stage: build + + include: + - name: Clippy + stage: check + rust: nightly + before_script: rustup component add clippy + script: make lint + + - name: rustfmt + stage: check + rust: nightly + before_script: rustup component add rustfmt + script: make fmt check=yes + + - name: medea-jason (stable) + stage: build + rust: stable + before_script: + - rm -f /home/travis/.cargo/bin/wasm-pack + - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + script: + - make release.npm crate=medea-jason publish=no + + - name: medea (stable) + stage: build + rust: stable + script: cargo build --bin medea + + - name: medea (beta) + stage: build + rust: beta + script: cargo build --bin medea + + - name: medea (nightly) + stage: build + rust: nightly + script: cargo build --bin medea + + - name: unit (stable) + stage: test + rust: stable + script: make test.unit crate=@all + +before_deploy: + - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + - curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + +deploy: + - provider: script + script: make release.crates crate=medea publish=yes + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-[0-9]+\.[0-9]+\.[0-9]+ + - provider: releases + skip_cleanup: true + api_key: $GH_TOKEN + name: $TRAVIS_TAG + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-[0-9]+\.[0-9]+\.[0-9]+ + + - provider: script + script: make release crate=medea-jason publish=yes + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-jason-[0-9]+\.[0-9]+\.[0-9]+ + - provider: releases + skip_cleanup: true + api_key: $GH_TOKEN + name: $TRAVIS_TAG + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-jason-[0-9]+\.[0-9]+\.[0-9]+ + + - provider: script + script: make release.crates crate=medea-client-api-proto publish=yes + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-client-api-proto-[0-9]+\.[0-9]+\.[0-9]+ + - provider: releases + skip_cleanup: true + api_key: $GH_TOKEN + name: $TRAVIS_TAG + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-client-api-proto-[0-9]+\.[0-9]+\.[0-9]+ + + - provider: script + script: make release.crates crate=medea-macro publish=yes + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-macro-[0-9]+\.[0-9]+\.[0-9]+ + - provider: releases + skip_cleanup: true + api_key: $GH_TOKEN + name: $TRAVIS_TAG + on: + tags: true + condition: $TRAVIS_TAG =~ ^medea-macro-[0-9]+\.[0-9]+\.[0-9]+ + +notifications: + email: + on_success: never + on_failure: always diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..73c915af0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,32 @@ +`medea` changelog +================= + +All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. + + + + +## TBD [0.1.0] · 2019-08-?? +[0.1.0]: /../../tree/medea-0.1.0 + +[Milestone](/../../milestone/1) | [Roadmap](/../../issues/8) + +### Added + +- WebRTC: + - Basic signalling capabilities ([#16](/../../pull/16)); + - [Coturn] integration ([#20](/../../pull/20), [#42](/../../pull/42)). +- Deployment: + - Graceful shutdown ([#30](/../../pull/30)); + - Docker image ([#35](/../../pull/35)). +- Configuration: + - Ability to parse from files and env vars ([#15](/../../pull/15)). +- Logging: + - Structured logging to STDOUT/STDERR ([#12](/../../pull/12)). + + + + + +[Coturn]: https://github.com/coturn/coturn +[Semantic Versioning 2.0.0]: https://semver.org diff --git a/Cargo.lock b/Cargo.lock index 3b91c81e0..ce41421f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -985,26 +985,6 @@ name = "itoa" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "jason" -version = "0.1.0-dev" -dependencies = [ - "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "macro-attr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "medea-client-api-proto 0.1.0-dev", - "medea-macro 0.1.0-dev", - "newtype_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-futures 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-test 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", - "wee_alloc 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "js-sys" version = "0.3.25" @@ -1169,6 +1149,26 @@ dependencies = [ "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "medea-jason" +version = "0.1.0-dev" +dependencies = [ + "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "macro-attr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "medea-client-api-proto 0.1.0-dev", + "medea-macro 0.1.0-dev", + "newtype_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-test 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "wee_alloc 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "medea-macro" version = "0.1.0-dev" diff --git a/Cargo.toml b/Cargo.toml index 3882377d9..aa705614d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,13 @@ version = "0.1.0-dev" edition = "2018" description = "Medea media server" authors = ["Instrumentisto Team "] +license = "MPL 2.0" +documentation = "https://docs.rs/medea" homepage = "https://github.com/instrumentisto/medea" -# documentation = "https://docs.rs/medea" -readme = "README.md" repository = "https://github.com/instrumentisto/medea" +readme = "README.md" +keywords = ["medea", "media-server"] +categories = ["multimedia"] [workspace] members = [ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..3759302a4 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,356 @@ +Mozilla Public License Version 2.0 +================================== + +### 1. Definitions + +**1.1. “Contributor”** + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +**1.2. “Contributor Version”** + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +**1.3. “Contribution”** + means Covered Software of a particular Contributor. + +**1.4. “Covered Software”** + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +**1.5. “Incompatible With Secondary Licenses”** + means + +* **(a)** that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or +* **(b)** that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +**1.6. “Executable Form”** + means any form of the work other than Source Code Form. + +**1.7. “Larger Work”** + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +**1.8. “License”** + means this document. + +**1.9. “Licensable”** + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +**1.10. “Modifications”** + means any of the following: + +* **(a)** any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or +* **(b)** any new file in Source Code Form that contains any Covered + Software. + +**1.11. “Patent Claims” of a Contributor** + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +**1.12. “Secondary License”** + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +**1.13. “Source Code Form”** + means the form of the work preferred for making modifications. + +**1.14. “You” (or “Your”)** + means an individual or a legal entity exercising rights under this + License. For legal entities, “You” includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, “control” means **(a)** the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or **(b)** ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + + +### 2. License Grants and Conditions + +#### 2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +* **(a)** under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and +* **(b)** under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +#### 2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +#### 2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +* **(a)** for any code that a Contributor has removed from Covered Software; + or +* **(b)** for infringements caused by: **(i)** Your and any other third party's + modifications of Covered Software, or **(ii)** the combination of its + Contributions with other software (except as part of its Contributor + Version); or +* **(c)** under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +#### 2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +#### 2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +#### 2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +#### 2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + + +### 3. Responsibilities + +#### 3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +#### 3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +* **(a)** such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +* **(b)** You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +#### 3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +#### 3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +#### 3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + + +### 4. Inability to Comply Due to Statute or Regulation + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: **(a)** comply with +the terms of this License to the maximum extent possible; and **(b)** +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + + +### 5. Termination + +**5.1.** The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated **(a)** provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and **(b)** on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +**5.2.** If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +**5.3.** In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + + +### 6. Disclaimer of Warranty + +> Covered Software is provided under this License on an “as is” +> basis, without warranty of any kind, either expressed, implied, or +> statutory, including, without limitation, warranties that the +> Covered Software is free of defects, merchantable, fit for a +> particular purpose or non-infringing. The entire risk as to the +> quality and performance of the Covered Software is with You. +> Should any Covered Software prove defective in any respect, You +> (not any Contributor) assume the cost of any necessary servicing, +> repair, or correction. This disclaimer of warranty constitutes an +> essential part of this License. No use of any Covered Software is +> authorized under this License except under this disclaimer. + +### 7. Limitation of Liability + +> Under no circumstances and under no legal theory, whether tort +> (including negligence), contract, or otherwise, shall any +> Contributor, or anyone who distributes Covered Software as +> permitted above, be liable to You for any direct, indirect, +> special, incidental, or consequential damages of any character +> including, without limitation, damages for lost profits, loss of +> goodwill, work stoppage, computer failure or malfunction, or any +> and all other commercial damages or losses, even if such party +> shall have been informed of the possibility of such damages. This +> limitation of liability shall not apply to liability for death or +> personal injury resulting from such party's negligence to the +> extent applicable law prohibits such limitation. Some +> jurisdictions do not allow the exclusion or limitation of +> incidental or consequential damages, so this exclusion and +> limitation may not apply to You. + + +### 8. Litigation + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + + +### 9. Miscellaneous + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + + +### 10. Versions of the License + +#### 10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +#### 10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +#### 10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +#### 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +## Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +## Exhibit B - “Incompatible With Secondary Licenses” Notice + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + diff --git a/Makefile b/Makefile index cf1d461b9..f9ce80799 100644 --- a/Makefile +++ b/Makefile @@ -44,10 +44,19 @@ deps: cargo yarn docs: docs.rust +fmt: cargo.fmt + + lint: cargo.lint -fmt: cargo.fmt +# Build and publish project crate everywhere. +# +# Usage: +# make release crate=(medea|medea-jason|) +# [publish=(no|yes)] + +release: release.crates release.npm test: test.unit @@ -203,20 +212,13 @@ test-unit-crate = $(if $(call eq,$(crate),),@all,$(crate)) test.unit: ifeq ($(test-unit-crate),@all) - @make test.unit crate=medea-client-api-proto @make test.unit crate=medea-macro + @make test.unit crate=medea-client-api-proto + @make test.unit crate=medea-jason @make test.unit crate=medea - @make test.unit crate=jason else -ifeq ($(test-unit-crate),medea) - cargo test --bin medea -else -ifeq ($(test-unit-crate),jason) - wasm-pack test --headless --firefox jason -endif cargo test -p $(test-unit-crate) endif -endif @@ -225,20 +227,58 @@ endif # Releasing commands # ###################### -# Build and publish Jason application to npm +# Build and publish project crate to crates.io. # # Usage: -# make release.jason +# make release.crates crate=(medea|medea-jason|) +# [token=($CARGO_TOKEN|)] +# [publish=(no|yes)] + +release-crates-token = $(if $(call eq,$(token),),${CARGO_TOKEN},$(token)) +release-crates-dir = $(error No crate '$(crate)' exists) +ifeq ($(crate),medea) +release-crates-dir = +endif +ifeq ($(crate),medea-jason) +release-crates-dir = jason +endif +ifeq ($(crate),medea-client-api-proto) +release-crates-dir = proto/client-api +endif +ifeq ($(crate),medea-macro) +release-crates-dir = crates/medea-macro +endif -release.jason: - @rm -rf jason/pkg/ - wasm-pack build -t web jason - wasm-pack publish +release.crates: + cd $(release-crates-dir)/ && \ + $(if $(call eq,$(publish),yes),\ + cargo publish --token $(release-crates-token) ,\ + cargo package ) release.helm: helm.package.release +# Build and publish project crate to NPM. +# +# Usage: +# make release.npm [crate=medea-jason] +# [publish=(no|yes)] + +release-npm-crate = $(if $(call eq,$(crate),),medea-jason,$(crate)) +release-npm-dir = $(error No NPM crate '$(release-npm-crate)' exists) +ifeq ($(release-npm-crate),medea-jason) +release-npm-dir = jason +endif + +release.npm: + @rm -rf $(release-npm-dir)/pkg/ + wasm-pack build -t web $(release-npm-dir)/ +ifeq ($(publish),yes) + wasm-pack publish $(release-npm-dir)/ +endif + + ################### @@ -512,7 +552,7 @@ endef helm helm.down helm.init helm.lint helm.list \ helm.package helm.package.release helm.up \ minikube.boot \ - release.jason release.helm \ + release release.crates release.helm release.npm \ test test.unit \ up up.coturn up.demo up.dev up.jason up.medea \ yarn diff --git a/README.md b/README.md index b9f8434f3..9c5adaecd 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,22 @@ Medea -Medea media server +[![Travis.org](https://img.shields.io/travis/instrumentisto/medea/master)](https://travis-ci.org/instrumentisto/medea/branches) +[![Crates.io](https://img.shields.io/crates/v/medea)](https://crates.io/crates/medea) +![Crates.io license](https://img.shields.io/crates/l/medea) -__DEVELOPMENT IN PROGRESS__ +[Code Docs](https://docs.rs/medea) | +[Changelog](CHANGELOG.md) -{"MakeSdpOffer":{"peer":0,"sdp_offer":"caller_offer"}} +Medea media server. + +__Currently, in early development phase.__ + + + + +## License + +Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + +This Source Code Form is subject to the terms of the [Mozilla Public License, v. 2.0](LICENSE.md). If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 000000000..9fde0fb39 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,77 @@ +HOWTO: Releasing +================ + +All releases of this repository are normally made by [Travis CI] when release [Git tag][2] is pushed. Manual releasing should be avoided asap. + + + + +## BEFORE release + +1. __Ensure crate's dependencies do not contain `path` option in `Cargo.toml`.__ +While referring local dependency via `path` is neat and helpful for development, it cannot be used for publishing a release version to [crates.io]. + +2. __Set the correct crate version in its `Cargo.toml`.__ +Usually, this is a change from `x.y.z-dev` to `x.y.z`. Ensure version bump follows [Semantic Versioning 2.0.0]. + +3. __Check release build succeeds with `cargo package`.__ +To be sure that crate will be released OK on [crates.io] run `make release.crates crate= publish=no` and fix any appeared errors. + +4. __Correct and prepare crate's `CHANGELOG.md`.__ +All its user-facing changes should be described explicitly and clear. It should contain links to all related milestones and roadmaps of this release. It should contain the correct version and date of release. + + + + +## Realising + +1. Commit all the changes for the prepared release with a commit message: + ``` + Bump up '' version to + ``` + +2. Apply the release Git tag. Its format must be `-`. For example: + - `medea-macro-3.2.1` to release `3.2.1` version of `medea-macro` crate; + - `medea-2.4.8-beta.1` to release `2.4.8-beta.1` version of `medea` crate. + +3. Push the release Git tag to GitHub. + + + + +## After release + +After release there is no need to switch crate's version back to `x.y.z-dev` and refer its local dependencies with `path` option immediately. Just do it when your development process would really require such change. + + + + +## Broken release + +If somehow the incorrect code has been released, the following steps should be done: +1. [Yank][3] the broken version of released crate on [crates.io]. +2. Apply the necessary fixes to the code base. +3. Bump up patch version of the crate. +4. Prepare its release and push it. + + + + +## Manual releasing + +To perform a full releasing process manually, carefully examine `deploy` section of `.travis.yml` spec and repeat the necessary actions. Beware that releasing process may involve publishing not only to [crates.io], but also to [GitHub Releases][1], [NPM] and [GitHub Pages] (Helm chats, etc). + + + + + +[crates.io]: https://crates.io +[GitHub Pages]: https://pages.github.com +[Helm]: https://helm.sh +[NPM]: https://www.npmjs.com +[Semantic Versioning 2.0.0]: https://semver.org +[Travis CI]: https://travis-ci.org + +[1]: https://help.github.com/en/articles/creating-releases +[2]: https://git-scm.com/book/en/v2/Git-Basics-Tagging +[3]: https://doc.rust-lang.org/cargo/reference/publishing.html#cargo-yank diff --git a/crates/medea-macro/CHANGELOG.md b/crates/medea-macro/CHANGELOG.md new file mode 100644 index 000000000..5d91c0137 --- /dev/null +++ b/crates/medea-macro/CHANGELOG.md @@ -0,0 +1,21 @@ +`medea-macro` changelog +======================= + +All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. + + + + +## TBD [0.1.0] · 2019-08-?? +[0.1.0]: /../../tree/medea-macro-0.1.0/crates/medea-macro + +### Added + +- `#[enum_delegate]` macro for delegating function calls to `enum` variants fields ([#23](/../../pull/23)); +- `#[dispatchable]` macro for dispatching `enum`-based events ([#26](/../../pull/26)). + + + + + +[Semantic Versioning 2.0.0]: https://semver.org diff --git a/crates/medea-macro/Cargo.toml b/crates/medea-macro/Cargo.toml index a5332dca0..fe7f5f06e 100644 --- a/crates/medea-macro/Cargo.toml +++ b/crates/medea-macro/Cargo.toml @@ -2,11 +2,15 @@ name = "medea-macro" version = "0.1.0-dev" edition = "2018" -description = "Macros for Medea media server project" +description = "Internal macros for Medea media server project" authors = ["Instrumentisto Team "] -homepage = "https://github.com/instrumentisto/medea" -# documentation = "https://docs.rs/medea-macro" -repository = "https://github.com/instrumentisto/medea" +license = "MIT/Apache 2.0" +documentation = "https://docs.rs/medea-macro" +homepage = "https://github.com/instrumentisto/medea/tree/master/crates/medea-macro" +repository = "https://github.com/instrumentisto/medea/tree/master/crates/medea-macro" +readme = "README.md" +keywords = ["medea", "macro", "derive"] +categories = ["development-tools::build-utils"] [lib] proc-macro = true diff --git a/crates/medea-macro/LICENSE-APACHE.md b/crates/medea-macro/LICENSE-APACHE.md new file mode 100644 index 000000000..24e951b55 --- /dev/null +++ b/crates/medea-macro/LICENSE-APACHE.md @@ -0,0 +1,194 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/crates/medea-macro/LICENSE-MIT.md b/crates/medea-macro/LICENSE-MIT.md new file mode 100644 index 000000000..8852bcc25 --- /dev/null +++ b/crates/medea-macro/LICENSE-MIT.md @@ -0,0 +1,25 @@ +The MIT License (MIT) +===================== + +Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/crates/medea-macro/README.md b/crates/medea-macro/README.md new file mode 100644 index 000000000..3e335814d --- /dev/null +++ b/crates/medea-macro/README.md @@ -0,0 +1,35 @@ +medea-macro +=========== + +[![Crates.io](https://img.shields.io/crates/v/medea-macro)](https://crates.io/crates/medea-macro) +![Crates.io license](https://img.shields.io/crates/l/medea-macro) + +[API Docs](https://docs.rs/medea-macro) | +[Changelog](CHANGELOG.md) + +Internal macros for [Medea] media server project. + +__DO NOT use this crate directly.__ It's for internal use by [Medea] crates only. + + + + +## License + +This project is licensed under either of + +- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE.md) or http://www.apache.org/licenses/LICENSE-2.0) +- MIT license ([LICENSE-MIT](LICENSE-MIT.md) or http://opensource.org/licenses/MIT) + +at your option. + + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + + + + + +[Medea]: https://github.com/instrumentisto/medea diff --git a/jason/CHANGELOG.md b/jason/CHANGELOG.md new file mode 100644 index 000000000..b704793cb --- /dev/null +++ b/jason/CHANGELOG.md @@ -0,0 +1,45 @@ +`medea-jason` changelog +======================= + +All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. + + + + +## TBD [0.1.0] · 2019-08-?? +[0.1.0]: /../../tree/medea-jason-0.1.0/jason + +[Milestone](/../../milestone/1) | [Roadmap](/../../issues/8) + +### Added + +- Transport and messaging ([#18](/../../pull/18)): + - Library API: + - `new Jason()`; + - `Jason.join_room()`; + - `Jason.dispose()`. + - RPC transport and heartbeat. +- Ability to use ICE servers provided by server ([#20](/../../pull/20)). +- Signalling ([#22](/../../pull/22)): + - Library API: + - `RoomHandle.on_new_connection` callback. + - Handling of RPC events: + - `PeerCreated`; + - `SdpAnswerMade`; + - `IceCandidateDiscovered`; + - `PeersRemoved`. + - Emitting of RPC commands: + - `MakeSdpOffer`; + - `MakeSdpAnswer`; + - `SetIceCandidate`. +- Media management ([#22](/../../pull/22)): + - Library API: + - `MediaStreamHandle.get_media_stream()`; + - `ConnectionHandle.on_remote_stream` callback; + - `Jason.on_local_stream` callback. + + + + + +[Semantic Versioning 2.0.0]: https://semver.org diff --git a/jason/Cargo.toml b/jason/Cargo.toml index d5243c4bf..26be96fd1 100644 --- a/jason/Cargo.toml +++ b/jason/Cargo.toml @@ -1,12 +1,16 @@ [package] -name = "jason" +name = "medea-jason" version = "0.1.0-dev" edition = "2018" -description = "Medea media server client application" +description = "Client library for Medea media server" authors = ["Instrumentisto Team "] -homepage = "https://github.com/instrumentisto/medea" +license = "MPL 2.0" +documentation = "https://docs.rs/medea-jason" +homepage = "https://github.com/instrumentisto/medea/tree/master/jason" +repository = "https://github.com/instrumentisto/medea/tree/master/jason" readme = "README.md" -repository = "https://github.com/instrumentisto/medea" +keywords = ["medea", "jason", "client", "client-api", "browser"] +categories = ["multimedia", "api-bindings", "web-programming", "wasm"] [lib] crate-type = ["cdylib", "rlib"] diff --git a/jason/LICENSE.md b/jason/LICENSE.md new file mode 100644 index 000000000..3759302a4 --- /dev/null +++ b/jason/LICENSE.md @@ -0,0 +1,356 @@ +Mozilla Public License Version 2.0 +================================== + +### 1. Definitions + +**1.1. “Contributor”** + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +**1.2. “Contributor Version”** + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +**1.3. “Contribution”** + means Covered Software of a particular Contributor. + +**1.4. “Covered Software”** + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +**1.5. “Incompatible With Secondary Licenses”** + means + +* **(a)** that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or +* **(b)** that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +**1.6. “Executable Form”** + means any form of the work other than Source Code Form. + +**1.7. “Larger Work”** + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +**1.8. “License”** + means this document. + +**1.9. “Licensable”** + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +**1.10. “Modifications”** + means any of the following: + +* **(a)** any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or +* **(b)** any new file in Source Code Form that contains any Covered + Software. + +**1.11. “Patent Claims” of a Contributor** + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +**1.12. “Secondary License”** + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +**1.13. “Source Code Form”** + means the form of the work preferred for making modifications. + +**1.14. “You” (or “Your”)** + means an individual or a legal entity exercising rights under this + License. For legal entities, “You” includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, “control” means **(a)** the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or **(b)** ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + + +### 2. License Grants and Conditions + +#### 2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +* **(a)** under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and +* **(b)** under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +#### 2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +#### 2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +* **(a)** for any code that a Contributor has removed from Covered Software; + or +* **(b)** for infringements caused by: **(i)** Your and any other third party's + modifications of Covered Software, or **(ii)** the combination of its + Contributions with other software (except as part of its Contributor + Version); or +* **(c)** under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +#### 2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +#### 2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +#### 2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +#### 2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + + +### 3. Responsibilities + +#### 3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +#### 3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +* **(a)** such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +* **(b)** You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +#### 3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +#### 3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +#### 3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + + +### 4. Inability to Comply Due to Statute or Regulation + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: **(a)** comply with +the terms of this License to the maximum extent possible; and **(b)** +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + + +### 5. Termination + +**5.1.** The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated **(a)** provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and **(b)** on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +**5.2.** If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +**5.3.** In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + + +### 6. Disclaimer of Warranty + +> Covered Software is provided under this License on an “as is” +> basis, without warranty of any kind, either expressed, implied, or +> statutory, including, without limitation, warranties that the +> Covered Software is free of defects, merchantable, fit for a +> particular purpose or non-infringing. The entire risk as to the +> quality and performance of the Covered Software is with You. +> Should any Covered Software prove defective in any respect, You +> (not any Contributor) assume the cost of any necessary servicing, +> repair, or correction. This disclaimer of warranty constitutes an +> essential part of this License. No use of any Covered Software is +> authorized under this License except under this disclaimer. + +### 7. Limitation of Liability + +> Under no circumstances and under no legal theory, whether tort +> (including negligence), contract, or otherwise, shall any +> Contributor, or anyone who distributes Covered Software as +> permitted above, be liable to You for any direct, indirect, +> special, incidental, or consequential damages of any character +> including, without limitation, damages for lost profits, loss of +> goodwill, work stoppage, computer failure or malfunction, or any +> and all other commercial damages or losses, even if such party +> shall have been informed of the possibility of such damages. This +> limitation of liability shall not apply to liability for death or +> personal injury resulting from such party's negligence to the +> extent applicable law prohibits such limitation. Some +> jurisdictions do not allow the exclusion or limitation of +> incidental or consequential damages, so this exclusion and +> limitation may not apply to You. + + +### 8. Litigation + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + + +### 9. Miscellaneous + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + + +### 10. Versions of the License + +#### 10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +#### 10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +#### 10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +#### 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +## Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +## Exhibit B - “Incompatible With Secondary Licenses” Notice + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + diff --git a/jason/README.md b/jason/README.md index 2dd63e0ed..303113114 100644 --- a/jason/README.md +++ b/jason/README.md @@ -1,6 +1,28 @@ Jason ===== -Medea media server client side application. +[![Crates.io](https://img.shields.io/crates/v/medea-jason)](https://crates.io/crates/medea-jason) +[![npm](https://img.shields.io/npm/v/medea-jason)](https://www.npmjs.com/package/medea-jason) +![Crates.io license](https://img.shields.io/crates/l/medea-jason) -__DEVELOPMENT IN PROGRESS__ +[API Docs](https://docs.rs/medea-jason) | +[Changelog](CHANGELOG.md) + +Client library for [Medea] media server. + +__Currently, in early development phase.__ + + + + +## License + +Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + +This Source Code Form is subject to the terms of the [Mozilla Public License, v. 2.0](LICENSE.md). If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + + + +[Medea]: https://github.com/instrumentisto/medea diff --git a/jason/src/api/connection.rs b/jason/src/api/connection.rs index 5a43079e2..e54f8aa72 100644 --- a/jason/src/api/connection.rs +++ b/jason/src/api/connection.rs @@ -1,4 +1,4 @@ -//! Connection with specific remote [`Member`]. +//! Connection with specific remote `Member`. use std::{ cell::RefCell, @@ -21,16 +21,16 @@ struct InnerConnection { on_remote_stream: Callback, } -/// Connection with a specific remote [`Member`], that is used on JS side. +/// Connection with a specific remote `Member`, that is used on JS side. /// -/// Actually, represents a [`Weak`]-based handle to [`InnerConnection`]. +/// Actually, represents a [`Weak`]-based handle to `InnerConnection`. #[allow(clippy::module_name_repetitions)] #[wasm_bindgen] pub struct ConnectionHandle(Weak>); #[wasm_bindgen] impl ConnectionHandle { - /// Sets callback, which will be invoked on remote [`Member`] media stream + /// Sets callback, which will be invoked on remote `Member` media stream /// arrival. pub fn on_remote_stream( &mut self, @@ -44,7 +44,7 @@ impl ConnectionHandle { .ok_or_else(|| WasmErr::from("Detached state").into()) } - /// Returns ID of the remote [`Member`]. + /// Returns ID of the remote `Member`. pub fn member_id(&self) -> Result { self.0 .upgrade() diff --git a/jason/src/api/mod.rs b/jason/src/api/mod.rs index 0a0251856..6e94ee111 100644 --- a/jason/src/api/mod.rs +++ b/jason/src/api/mod.rs @@ -70,8 +70,9 @@ impl Jason { } /// Sets `on_local_stream` callback, which will be invoked once media - /// acquisition request will resolve returning [`MediaStreamHandle`] or - /// [`WasmErr`]. + /// acquisition request will resolve returning + /// [`MediaStreamHandle`](crate::media::MediaStreamHandle) or + /// [`WasmErr`](crate::utils::errors::WasmErr). pub fn on_local_stream(&self, f: js_sys::Function) { self.0.borrow_mut().media_manager.set_on_local_stream(f); } diff --git a/jason/src/api/room.rs b/jason/src/api/room.rs index 89ecfa3fd..b6fb1bbfa 100644 --- a/jason/src/api/room.rs +++ b/jason/src/api/room.rs @@ -27,18 +27,18 @@ use crate::{ use super::{connection::Connection, ConnectionHandle}; -/// JS side handle to [`Room`] where all the media happens. +/// JS side handle to `Room` where all the media happens. /// -/// Actually, represents a [`Weak`]-based handle to [`InnerRoom`]. +/// Actually, represents a [`Weak`]-based handle to `InnerRoom`. /// -/// For using [`RoomHandle`] on Rust side, consider the [`Room`]. +/// For using [`RoomHandle`] on Rust side, consider the `Room`. #[allow(clippy::module_name_repetitions)] #[wasm_bindgen] pub struct RoomHandle(Weak>); #[wasm_bindgen] impl RoomHandle { - /// Sets callback, which will be invoked on new [`Connection`] establishing. + /// Sets callback, which will be invoked on new `Connection` establishing. pub fn on_new_connection( &mut self, f: js_sys::Function, diff --git a/jason/src/lib.rs b/jason/src/lib.rs index 846efad6c..5b46cb81a 100644 --- a/jason/src/lib.rs +++ b/jason/src/lib.rs @@ -1,3 +1,6 @@ +// TODO: when using enum's Self will be in stable, remove it. +#![allow(clippy::use_self)] + pub mod api; pub mod media; pub mod peer; diff --git a/jason/src/media/stream.rs b/jason/src/media/stream.rs index f480a71aa..335d3c1d3 100644 --- a/jason/src/media/stream.rs +++ b/jason/src/media/stream.rs @@ -105,7 +105,7 @@ impl MediaStream { /// JS side handle to [`MediaStream`]. /// -/// Actually, represents a [`Weak`]-based handle to [`InnerStream`]. +/// Actually, represents a [`Weak`]-based handle to `InnerStream`. /// /// For using [`MediaStreamHandle`] on Rust side, consider the [`MediaStream`]. #[wasm_bindgen] diff --git a/jason/src/peer/mod.rs b/jason/src/peer/mod.rs index 981df698a..a17f584a4 100644 --- a/jason/src/peer/mod.rs +++ b/jason/src/peer/mod.rs @@ -161,8 +161,8 @@ impl PeerConnection { self.0.media_connections.get_mids() } - /// Sync provided tracks creating all required [`Sender`]s and - /// [`Receiver`]s, request local stream if required, get, set and return + /// Sync provided tracks creating all required `Sender`s and + /// `Receiver`s, request local stream if required, get, set and return /// sdp offer. pub fn get_offer( &self, @@ -215,11 +215,11 @@ impl PeerConnection { self.0.peer.set_remote_description(SdpType::Answer(answer)) } - /// Sync provided tracks creating all required [`Sender`]s and - /// [`Receiver`]s, request local stream if required. + /// Sync provided tracks creating all required `Sender`s and + /// `Receiver`s, request local stream if required. /// `set_remote_description` will create all transceivers and fire all - /// `on_track` events, so it updates [`Receiver`]s before - /// `set_remote_description` and update [`Sender`]s after. + /// `on_track` events, so it updates `Receiver`s before + /// `set_remote_description` and update `Sender`s after. /// /// [1]: https://www.w3.org/TR/webrtc/#rtcpeerconnection-interface pub fn process_offer( diff --git a/jason/src/rpc/mod.rs b/jason/src/rpc/mod.rs index 87c0a52f6..79e8ff246 100644 --- a/jason/src/rpc/mod.rs +++ b/jason/src/rpc/mod.rs @@ -102,7 +102,7 @@ impl RpcClient { } /// Creates new WebSocket connection to remote media server. - /// Starts [`Heatbeat`] if connection succeeds and binds handlers + /// Starts `Heartbeat` if connection succeeds and binds handlers /// on receiving messages from server and closing socket. pub fn init(&mut self) -> impl Future { let inner = Rc::clone(&self.0); diff --git a/proto/client-api/CHANGELOG.md b/proto/client-api/CHANGELOG.md new file mode 100644 index 000000000..abca7a177 --- /dev/null +++ b/proto/client-api/CHANGELOG.md @@ -0,0 +1,37 @@ +`medea-client-api-proto` changelog +================================== + +All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. + + + + +## TBD [0.1.0] · 2019-08-?? +[0.1.0]: /../../tree/medea-client-api-proto-0.1.0/proto/client-api + +[Milestone](/../../milestone/1) | [Roadmap](/../../issues/8) + +### Added + +- RPC messages ([#16](/../../pull/16)): + - Server messages: + - `Pong`; + - `Event`. + - Client messages: + - `Ping`; + - `Command`. + - Client commands: + - `MakeSdpOffer`; + - `MakeSdpAnswer`; + - `SetIceCandidate`. + - Server events: + - `PeerCreated`; + - `SdpAnswerMade`; + - `IceCandidateDiscovered`; + - `PeersRemoved`. + + + + + +[Semantic Versioning 2.0.0]: https://semver.org diff --git a/proto/client-api/Cargo.toml b/proto/client-api/Cargo.toml index ab0d0e3f0..d2487d219 100644 --- a/proto/client-api/Cargo.toml +++ b/proto/client-api/Cargo.toml @@ -4,9 +4,13 @@ version = "0.1.0-dev" edition = "2018" description = "Client API protocol implementation for Medea media server" authors = ["Instrumentisto Team "] -homepage = "https://github.com/instrumentisto/medea" +license = "MIT/Apache 2.0" +documentation = "https://docs.rs/medea-client-api-proto" +homepage = "https://github.com/instrumentisto/medea/tree/master/proto/client-api" +repository = "https://github.com/instrumentisto/medea/tree/master/proto/client-api" readme = "README.md" -repository = "https://github.com/instrumentisto/medea" +keywords = ["medea", "client-api"] +categories = ["api-bindings", "web-programming"] [features] default = ["jason", "medea"] diff --git a/proto/client-api/LICENSE-APACHE.md b/proto/client-api/LICENSE-APACHE.md new file mode 100644 index 000000000..24e951b55 --- /dev/null +++ b/proto/client-api/LICENSE-APACHE.md @@ -0,0 +1,194 @@ +Apache License +============== + +_Version 2.0, January 2004_ +_<>_ + +### Terms and Conditions for use, reproduction, and distribution + +#### 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +#### 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +#### 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +#### 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +#### 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +#### 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +#### 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +#### 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +#### 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +### APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets `[]` replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same “printed page” as the copyright notice for easier identification within +third-party archives. + + Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/proto/client-api/LICENSE-MIT.md b/proto/client-api/LICENSE-MIT.md new file mode 100644 index 000000000..8852bcc25 --- /dev/null +++ b/proto/client-api/LICENSE-MIT.md @@ -0,0 +1,25 @@ +The MIT License (MIT) +===================== + +Copyright © 2019 Instrumentisto Team, https://github.com/instrumentisto + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/proto/client-api/README.md b/proto/client-api/README.md index c49f43b87..d37012c17 100644 --- a/proto/client-api/README.md +++ b/proto/client-api/README.md @@ -1,6 +1,35 @@ -Medea client API protocol +Medea Client API protocol ========================= -Client API protocol implementation for Medea media server. +[![Crates.io](https://img.shields.io/crates/v/medea-client-api-proto)](https://crates.io/crates/medea-client-api-proto) +![Crates.io license](https://img.shields.io/crates/l/medea-client-api-proto) -__DEVELOPMENT IN PROGRESS__ +[API Docs](https://docs.rs/medea-client-api-proto) | +[Changelog](CHANGELOG.md) + +Client API protocol implementation for [Medea] media server. + +__Currently, in early development phase.__ + + + + +## License + +This project is licensed under either of + +- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE.md) or http://www.apache.org/licenses/LICENSE-2.0) +- MIT license ([LICENSE-MIT](LICENSE-MIT.md) or http://opensource.org/licenses/MIT) + +at your option. + + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + + + + + +[Medea]: https://github.com/instrumentisto/medea diff --git a/proto/client-api/src/lib.rs b/proto/client-api/src/lib.rs index 7029bc6a0..121011137 100644 --- a/proto/client-api/src/lib.rs +++ b/proto/client-api/src/lib.rs @@ -1,3 +1,8 @@ +//! Client API protocol implementation for Medea media server. + +// TODO: when using enum's Self will be in stable, remove it. +#![allow(clippy::use_self)] + use std::collections::HashMap; use medea_macro::dispatchable; diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 81bf83f8e..c1157a9e5 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,4 +1,6 @@ -//! Implementation of Client API. +//! Implementation of [Client API]. +//! +//! [Client API]: http://tiny.cc/c80uaz mod session; diff --git a/src/api/client/rpc_connection.rs b/src/api/client/rpc_connection.rs index a5e6a8c64..a793077fd 100644 --- a/src/api/client/rpc_connection.rs +++ b/src/api/client/rpc_connection.rs @@ -1,4 +1,6 @@ //! [`RpcConnection`] with related messages. +//! +//! [`RpcConnection`]: crate::api::client::rpc_connection::RpcConnection use std::fmt; @@ -23,6 +25,8 @@ macro_attr! { } /// Abstraction over RPC connection with some remote [`Member`]. +/// +/// [`Member`]: crate::api::control::member::Member pub trait RpcConnection: fmt::Debug + Send { /// Closes [`RpcConnection`]. /// No [`RpcConnectionClosed`] signals should be emitted. @@ -30,6 +34,8 @@ pub trait RpcConnection: fmt::Debug + Send { fn close(&mut self) -> Box>; /// Sends [`Event`] to remote [`Member`]. + /// + /// [`Member`]: crate::api::control::member::Member fn send_event( &self, msg: EventMessage, @@ -41,15 +47,22 @@ pub trait RpcConnection: fmt::Debug + Send { #[rtype(result = "Result<(), AuthorizationError>")] pub struct Authorize { /// ID of [`Member`] to authorize [`RpcConnection`] for. + /// + /// [`Member`]: crate::api::control::member::Member pub member_id: MemberId, /// Credentials to authorize [`RpcConnection`] with. pub credentials: String, // TODO: &str when futures will allow references } /// Error of authorization [`RpcConnection`] in [`Room`]. +/// +/// [`Room`]: crate::signalling::Room #[derive(Debug)] pub enum AuthorizationError { /// Authorizing [`Member`] does not exists in the [`Room`]. + /// + /// [`Member`]: crate::api::control::member::Member + /// [`Room`]: crate::signalling::Room MemberNotExists, /// Provided credentials are invalid. InvalidCredentials, @@ -57,20 +70,28 @@ pub enum AuthorizationError { /// Signal of new [`RpcConnection`] being established with specified [`Member`]. /// Transport should consider dropping connection if message result is err. +/// +/// [`Member`]: crate::api::control::member::Member #[derive(Debug, Message)] #[rtype(result = "Result<(), ()>")] #[allow(clippy::module_name_repetitions)] pub struct RpcConnectionEstablished { /// ID of [`Member`] that establishes [`RpcConnection`]. + /// + /// [`Member`]: crate::api::control::member::Member pub member_id: MemberId, /// Established [`RpcConnection`]. pub connection: Box, } /// Signal of existing [`RpcConnection`] of specified [`Member`] being closed. +/// +/// [`Member`]: crate::api::control::member::Member #[derive(Debug, Message)] #[allow(clippy::module_name_repetitions)] pub struct RpcConnectionClosed { /// ID of [`Member`] which [`RpcConnection`] is closed. + /// + /// [`Member`]: crate::api::control::member::Member pub member_id: MemberId, /// Reason of why [`RpcConnection`] is closed. pub reason: ClosedReason, diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 7f1fe7d7f..2e555928b 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -83,6 +83,8 @@ fn ws_index( /// Context for [`App`] which holds all the necessary dependencies. pub struct Context { /// Repository of all currently existing [`Room`]s in application. + /// + /// [`Room`]: crate::signalling::Room pub rooms: RoomsRepository, /// Settings of application. diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 56e460f5c..bdcc4ca46 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -159,6 +159,8 @@ impl RpcConnection for Addr { } /// Sends [`Event`] to Web Client. + /// + /// [`Event`]: medea_client_api_proto::Event fn send_event( &self, msg: EventMessage, diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 318483547..dfacdfbe4 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -19,7 +19,7 @@ pub struct Member { } impl Member { - /// Returns new instance of [`Memebr`] with given credentials. + /// Returns new instance of [`Member`] with given credentials. pub fn new(id: Id, credentials: String) -> Self { Self { id, diff --git a/src/api/control/mod.rs b/src/api/control/mod.rs index db3c38fcd..929e0fd13 100644 --- a/src/api/control/mod.rs +++ b/src/api/control/mod.rs @@ -1,4 +1,6 @@ -//! Implementation of Control API. +//! Implementation of [Control API]. +//! +//! [Control API]: http://tiny.cc/380uaz mod member; diff --git a/src/conf/mod.rs b/src/conf/mod.rs index dc10a2b83..ac5f29a6a 100644 --- a/src/conf/mod.rs +++ b/src/conf/mod.rs @@ -12,6 +12,7 @@ use config::{Config, Environment, File}; use failure::Error; use serde::{Deserialize, Serialize}; +#[doc(inline)] pub use self::{ log::Log, rpc::Rpc, diff --git a/src/conf/turn.rs b/src/conf/turn.rs index 4a6bc373a..56b5394f9 100644 --- a/src/conf/turn.rs +++ b/src/conf/turn.rs @@ -44,6 +44,10 @@ pub struct Db { pub redis: Redis, } +/// Setting of [Redis] server which used by [coturn]. +/// +/// [Redis]: https://redis.io/ +/// [coturn]: https://github.com/coturn/coturn #[derive(Clone, Debug, Deserialize, Serialize, SmartDefault)] #[serde(default)] pub struct Redis { diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 000000000..4076fd302 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,125 @@ +//! Medea media server application. + +// TODO: when using enum's Self will be in stable, remove it. +#![allow(clippy::use_self)] + +#[macro_use] +pub mod utils; +pub mod api; +pub mod conf; +pub mod log; +pub mod media; +pub mod shutdown; +pub mod signalling; +pub mod turn; + +use std::{env, io, sync::Arc}; + +use actix::prelude::*; +use dotenv::dotenv; +use futures::IntoFuture as _; +use log::prelude::*; + +use crate::{ + api::{client::server::Server, control::Member}, + conf::Conf, + media::create_peers, + shutdown::GracefulShutdown, + signalling::{Room, RoomsRepository}, + turn::new_turn_auth_service, +}; + +pub fn run() -> io::Result<()> { + dotenv().ok(); + let config = Conf::parse().unwrap(); + + if let Some(lvl) = config.log.level() { + env::set_var("RUST_LOG", lvl.as_str()); + } + let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); + let _scope_guard = slog_scope::set_global_logger(logger); + slog_stdlog::init().unwrap(); + + info!("{:?}", config); + + actix::run(|| { + new_turn_auth_service(&config.turn) + .map_err(|err| error!("Error creating TurnAuthService {:?}", err)) + .and_then(|turn_auth_service| { + let members = hashmap! { + 1 => Member::new(1, "caller_credentials".to_owned()), + 2 => Member::new(2, "responder_credentials".to_owned()), + }; + + let rooms = (0..1000) + .map(|i: u64| { + ( + i, + Room::new( + i, + members.clone(), + create_peers(1, 2), + config.rpc.reconnect_timeout, + Arc::clone(&turn_auth_service), + ) + .start(), + ) + }) + .collect(); + + Ok((rooms, config)) + }) + .and_then(|(rooms, config): (Vec<(u64, Addr)>, _)| { + let graceful_shutdown = + GracefulShutdown::new(config.shutdown.timeout).start(); + + let futures: Vec<_> = rooms + .iter() + .map(|(_, room)| { + graceful_shutdown + .send(shutdown::Subscribe(shutdown::Subscriber { + addr: room.clone().recipient(), + priority: shutdown::Priority(2), + })) + .map_err(|e| { + error!( + "Shutdown subscription failed for Room: {}", + e + ) + }) + }) + .collect(); + + futures::future::join_all(futures) + .map(move |_| (rooms, graceful_shutdown, config)) + }) + .map(|(rooms, graceful_shutdown, config)| { + let rooms_repo = + RoomsRepository::new(rooms.into_iter().collect()); + (rooms_repo, graceful_shutdown, config) + }) + .and_then(|(rooms_repo, graceful_shutdown, config)| { + Server::run(rooms_repo, config) + .map_err(|e| { + error!("Error starting Client API HTTP server {:?}", e) + }) + .map(|server| { + graceful_shutdown + .send(shutdown::Subscribe(shutdown::Subscriber { + addr: server.recipient(), + priority: shutdown::Priority(1), + })) + .map_err(|e| { + error!( + "Shutdown subscription failed for Client \ + API HTTP server: {}", + e + ) + }) + .map(|_| ()) + }) + .into_future() + .flatten() + }) + }) +} diff --git a/src/log/prelude.rs b/src/log/prelude.rs index a09db6ec8..537645ab0 100644 --- a/src/log/prelude.rs +++ b/src/log/prelude.rs @@ -2,7 +2,7 @@ //! //! Use this module as following: //! ```rust -//! use crate::log::prelude::*; +//! use medea::log::prelude::*; //! ``` pub use slog::{slog_debug, slog_error, slog_info, slog_trace, slog_warn}; diff --git a/src/main.rs b/src/main.rs index 8237c1f82..0882a8978 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,122 +1,3 @@ -//! Medea media server application. - -#[macro_use] -pub mod utils; -pub mod api; -pub mod conf; -pub mod log; -pub mod media; -pub mod shutdown; -pub mod signalling; -pub mod turn; - -use std::{env, io, sync::Arc}; - -use actix::prelude::*; -use dotenv::dotenv; -use futures::IntoFuture as _; -use log::prelude::*; - -use crate::{ - api::{client::server::Server, control::Member}, - conf::Conf, - media::create_peers, - shutdown::GracefulShutdown, - signalling::{Room, RoomsRepository}, - turn::new_turn_auth_service, -}; - -fn main() -> io::Result<()> { - dotenv().ok(); - let config = Conf::parse().unwrap(); - - if let Some(lvl) = config.log.level() { - env::set_var("RUST_LOG", lvl.as_str()); - } - let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); - let _scope_guard = slog_scope::set_global_logger(logger); - slog_stdlog::init().unwrap(); - - info!("{:?}", config); - - actix::run(|| { - new_turn_auth_service(&config.turn) - .map_err(|err| error!("Error creating TurnAuthService {:?}", err)) - .and_then(|turn_auth_service| { - let members = hashmap! { - 1 => Member::new(1, "caller_credentials".to_owned()), - 2 => Member::new(2, "responder_credentials".to_owned()), - }; - - let rooms = (0..1000) - .map(|i: u64| { - ( - i, - Room::new( - i, - members.clone(), - create_peers(1, 2), - config.rpc.reconnect_timeout, - Arc::clone(&turn_auth_service), - ) - .start(), - ) - }) - .collect(); - - Ok((rooms, config)) - }) - .and_then(|(rooms, config): (Vec<(u64, Addr)>, _)| { - let graceful_shutdown = - GracefulShutdown::new(config.shutdown.timeout).start(); - - let futures: Vec<_> = rooms - .iter() - .map(|(_, room)| { - graceful_shutdown - .send(shutdown::Subscribe(shutdown::Subscriber { - addr: room.clone().recipient(), - priority: shutdown::Priority(2), - })) - .map_err(|e| { - error!( - "Shutdown subscription failed for Room: {}", - e - ) - }) - }) - .collect(); - - futures::future::join_all(futures) - .map(move |_| (rooms, graceful_shutdown, config)) - }) - .map(|(rooms, graceful_shutdown, config)| { - let rooms_repo = - RoomsRepository::new(rooms.into_iter().collect()); - (rooms_repo, graceful_shutdown, config) - }) - .and_then(|(rooms_repo, graceful_shutdown, config)| { - Server::run(rooms_repo, config) - .map_err(|e| { - error!("Error starting Client API HTTP server {:?}", e) - }) - .map(|server| { - graceful_shutdown - .send(shutdown::Subscribe(shutdown::Subscriber { - addr: server.recipient(), - priority: shutdown::Priority(1), - })) - .map_err(|e| { - error!( - "Shutdown subscription failed for Client \ - API HTTP server: {}", - e - ) - }) - .map(|_| ()) - }) - .into_future() - .flatten() - }) - }) +fn main() -> std::io::Result<()> { + medea::run() } diff --git a/src/media/ice_user.rs b/src/media/ice_user.rs index ba0de8129..e102ac605 100644 --- a/src/media/ice_user.rs +++ b/src/media/ice_user.rs @@ -1,3 +1,7 @@ +//! Representation of [coturn]'s user. +//! +//! [coturn]: https://github.com/coturn/coturn + use medea_client_api_proto::IceServer; use crate::signalling::RoomId; diff --git a/src/media/mod.rs b/src/media/mod.rs index e2f3f9f8a..54adde694 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -3,6 +3,7 @@ pub mod ice_user; pub mod peer; pub mod track; +#[doc(inline)] pub use self::{ ice_user::IceUser, peer::{ diff --git a/src/media/peer.rs b/src/media/peer.rs index 366291b26..ca44ed0c4 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -158,7 +158,9 @@ pub struct Context { senders: HashMap>, } -/// [`RTCPeerConnection`] representation. +/// [RTCPeerConnection] representation. +/// +/// [RTCPeerConnection]: https://webrtcglossary.com/peerconnection/ #[derive(Debug)] pub struct Peer { context: Context, @@ -167,6 +169,8 @@ pub struct Peer { impl Peer { /// Returns ID of [`Member`] associated with this [`Peer`]. + /// + /// [`Member`]: crate::api::control::member::Member pub fn member_id(&self) -> MemberId { self.context.member_id } @@ -182,6 +186,8 @@ impl Peer { } /// Returns ID of interconnected [`Member`]. + /// + /// [`Member`]: crate::api::control::member::Member pub fn partner_member_id(&self) -> Id { self.context.partner_member } @@ -226,6 +232,8 @@ impl Peer { impl Peer { /// Creates new [`Peer`] for [`Member`]. + /// + /// [`Member`]: crate::api::control::member::Member pub fn new( id: Id, member_id: MemberId, @@ -282,7 +290,7 @@ impl Peer { impl Peer { /// Sets local description and transition [`Peer`] - /// to [`WaitRemoteSDP`] state. + /// to [`WaitRemoteSdp`] state. pub fn set_local_sdp(self, sdp_offer: String) -> Peer { let mut context = self.context; context.sdp_offer = Some(sdp_offer); @@ -354,6 +362,8 @@ impl Peer { } /// Creates 1<=>1 [`Room`]. +/// +/// [`Room`]: crate::signalling::Room #[cfg(not(test))] pub fn create_peers( caller: MemberId, diff --git a/src/shutdown.rs b/src/shutdown.rs index 83091a2dc..11d2192ac 100644 --- a/src/shutdown.rs +++ b/src/shutdown.rs @@ -199,6 +199,7 @@ impl Handler for GracefulShutdown { } } +/// Error which indicates that process is shutting down at this moment. #[derive(Clone, Copy, Debug, Fail)] #[fail(display = "Process is shutting down at the moment")] pub struct ShuttingDownError; diff --git a/src/signalling/mod.rs b/src/signalling/mod.rs index ddf76119c..cad32e4b0 100644 --- a/src/signalling/mod.rs +++ b/src/signalling/mod.rs @@ -1,8 +1,14 @@ +//! [WebRTC] [signalling] related implementations. +//! +//! [WebRTC]: https://webrtcglossary.com/webrtc/ +//! [signalling]: https://webrtcglossary.com/signaling/ + pub mod participants; pub mod peers; pub mod room; pub mod room_repo; +#[doc(inline)] pub use self::{ room::{Id as RoomId, Room}, room_repo::RoomsRepository, diff --git a/src/signalling/participants.rs b/src/signalling/participants.rs index 13a48f3a3..7936a85ee 100644 --- a/src/signalling/participants.rs +++ b/src/signalling/participants.rs @@ -1,7 +1,11 @@ //! Participant is [`Member`] with [`RpcConnection`]. [`ParticipantService`] -//! stores [`Members`] and associated [`RpcConnection`]s, handles +//! stores [`Member`]s and associated [`RpcConnection`]s, handles //! [`RpcConnection`] authorization, establishment, message sending, Turn //! credentials management. +//! +//! [`Member`]: crate::api::control::member::Member +//! [`RpcConnection`]: crate::api::client::rpc_connection::RpcConnection +//! [`ParticipantService`]: crate::signalling::participants::ParticipantService use std::{ sync::Arc, @@ -63,7 +67,7 @@ impl From for ParticipantServiceErr { } /// Participant is [`Member`] with [`RpcConnection`]. [`ParticipantService`] -/// stores [`Members`] and associated [`RpcConnection`]s, handles +/// stores [`Member`]s and associated [`RpcConnection`]s, handles /// [`RpcConnection`] authorization, establishment, message sending. #[derive(Debug)] pub struct ParticipantService { @@ -141,7 +145,7 @@ impl ParticipantService { self.members.insert(member.id, member); } - /// Checks if [`Member`] has **active** [`RcpConnection`]. + /// Checks if [`Member`] has **active** [`RpcConnection`]. pub fn member_has_connection(&self, member_id: MemberId) -> bool { self.connections.contains_key(&member_id) && !self.drop_connection_tasks.contains_key(&member_id) @@ -164,7 +168,7 @@ impl ParticipantService { } } - /// Saves provided [`RpcConnection`], registers [`ICEUser`]. + /// Saves provided [`RpcConnection`], registers [`IceUser`]. /// If [`Member`] already has any other [`RpcConnection`], /// then it will be closed. pub fn connection_established( diff --git a/src/signalling/peers.rs b/src/signalling/peers.rs index 506c0ac04..c041dcec6 100644 --- a/src/signalling/peers.rs +++ b/src/signalling/peers.rs @@ -1,4 +1,7 @@ //! Repository that stores [`Room`]s [`Peer`]s. +//! +//! [`Room`]: crate::signalling::Room +//! [`Peer`]: crate::media::peer::Peer use hashbrown::HashMap; @@ -13,11 +16,16 @@ use crate::{ #[derive(Debug)] pub struct PeerRepository { /// [`Peer`]s of [`Member`]s in this [`Room`]. + /// + /// [`Member`]: crate::api::control::member::Member + /// [`Room`]: crate::signalling::Room peers: HashMap, } impl PeerRepository { /// Store [`Peer`] in [`Room`]. + /// + /// [`Room`]: crate::signalling::Room pub fn add_peer>(&mut self, peer: S) { let peer = peer.into(); self.peers.insert(peer.id(), peer); @@ -51,6 +59,8 @@ impl PeerRepository { /// Returns [`Peer`] of specified [`Member`]. /// /// Panic if [`Peer`] not exists. + /// + /// [`Member`]: crate::api::control::member::Member pub fn get_peers_by_member_id( &self, member_id: MemberId, diff --git a/src/signalling/room.rs b/src/signalling/room.rs index 9286ee56c..77d53ff0b 100644 --- a/src/signalling/room.rs +++ b/src/signalling/room.rs @@ -1,5 +1,7 @@ //! Room definitions and implementations. Room is responsible for media //! connection establishment between concrete [`Member`]s. +//! +//! [`Member`]: crate::api::control::member::Member use std::{collections::HashMap as StdHashMap, sync::Arc, time::Duration}; @@ -83,6 +85,8 @@ pub struct Room { id: Id, /// [`RpcConnection`]s of [`Member`]s in this [`Room`]. + /// + /// [`RpcConnection`]: crate::api::client::rpc_connection::RpcConnection pub participants: ParticipantService, /// [`Peer`]s of [`Member`]s in this [`Room`]. @@ -372,7 +376,7 @@ impl Handler for Room { type Result = ActFuture<(), ()>; /// Receives [`Command`] from Web client and passes it to corresponding - /// handlers. Will emit [`CloseRoom`] on any error. + /// handlers. Will emit `CloseRoom` on any error. fn handle( &mut self, msg: CommandMessage, @@ -423,6 +427,8 @@ impl Handler for Room { /// Saves new [`RpcConnection`] in [`ParticipantService`], initiates media /// establishment between members. + /// + /// [`RpcConnection`]: crate::api::client::rpc_connection::RpcConnection fn handle( &mut self, msg: RpcConnectionEstablished, diff --git a/src/turn/mod.rs b/src/turn/mod.rs index aa4b70c18..2200d2a6e 100644 --- a/src/turn/mod.rs +++ b/src/turn/mod.rs @@ -1,6 +1,11 @@ +//! [TURN] server managing implementation. +//! +//! [TURN]: https://webrtcglossary.com/turn + pub mod repo; pub mod service; +#[doc(inline)] pub use self::service::{ new_turn_auth_service, TurnAuthService, TurnServiceErr, UnreachablePolicy, }; diff --git a/src/turn/service.rs b/src/turn/service.rs index 70050deec..16faa570d 100644 --- a/src/turn/service.rs +++ b/src/turn/service.rs @@ -1,3 +1,8 @@ +//! Implementation of managing [coturn] [TURN] server. +//! +//! [coturn]: https://github.com/coturn/coturn +//! [TURN]: https://webrtcglossary.com/turn/ + use std::{fmt, sync::Arc}; use actix::{ @@ -64,7 +69,7 @@ impl TurnAuthService for Addr { ) } - /// Sends [`DeleteRoom`] to [`Service`]. + /// Sends `DeleteRoom` to [`Service`]. fn delete( &self, users: Vec, @@ -91,6 +96,7 @@ impl TurnAuthService for Addr { type ActFuture = Box>; +/// Error which can happen in [`TurnAuthService`]. #[derive(Debug, Fail)] pub enum TurnServiceErr { #[fail(display = "Error accessing TurnAuthRepo: {}", _0)] diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 82d6712ad..c9f4b619f 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,10 +1,11 @@ //! Helper utils used in project. -/// Creates new [`hashbrown::HashMap`] from a list of key-value pairs. +/// Creates new [hashbrown] `HashMap` from a list of key-value pairs. /// /// ## Example /// /// ```rust +/// # use medea::hashmap; /// let map = hashmap! { /// "a" => 1, /// "b" => 2, @@ -13,6 +14,8 @@ /// assert_eq!(map["b"], 2); /// assert_eq!(map.get("c"), None); /// ``` +/// +/// [hashbrown]:https://crates.io/crates/hashbrown #[macro_export] macro_rules! hashmap { (@single $($x:tt)*) => (());