├── verify ├── html │ ├── js │ │ ├── README.md │ │ ├── talks.css │ │ ├── bravo_alert │ │ │ ├── demo │ │ │ │ ├── demo_alert_simple.html │ │ │ │ ├── demo_alert_senior.html │ │ │ │ └── demo_alert_complex.html │ │ │ └── alert.js │ │ └── 3rdparty │ │ │ └── angular-resource.min.js │ ├── index.html │ └── ng_index.html ├── server.py └── README.md ├── golang ├── vendor │ └── github.com │ │ ├── ossrs │ │ └── go-oryx-lib │ │ │ ├── gmoryx │ │ │ ├── AndroidHTTPServer │ │ │ │ ├── settings.gradle │ │ │ │ ├── .gitignore │ │ │ │ ├── app │ │ │ │ │ ├── src │ │ │ │ │ │ └── main │ │ │ │ │ │ │ ├── res │ │ │ │ │ │ │ ├── values │ │ │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ │ │ ├── dimens.xml │ │ │ │ │ │ │ │ ├── colors.xml │ │ │ │ │ │ │ │ └── styles.xml │ │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ │ ├── values-w820dp │ │ │ │ │ │ │ │ └── dimens.xml │ │ │ │ │ │ │ └── layout │ │ │ │ │ │ │ │ └── activity_main.xml │ │ │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ │ │ └── java │ │ │ │ │ │ │ └── org │ │ │ │ │ │ │ └── ossrs │ │ │ │ │ │ │ └── gmoryx │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── httpd │ │ │ │ │ │ │ └── MainActivity.java │ │ │ │ │ └── build.gradle │ │ │ │ └── build.gradle │ │ │ ├── http.go │ │ │ ├── README.md │ │ │ └── sys_http.go │ │ │ ├── websocket │ │ │ ├── AUTHORS │ │ │ ├── mask_safe.go │ │ │ ├── client_clone.go │ │ │ ├── conn_read.go │ │ │ ├── conn_read_legacy.go │ │ │ ├── LICENSE │ │ │ ├── mask.go │ │ │ ├── example_test.go │ │ │ ├── client_clone_legacy.go │ │ │ ├── server_test.go │ │ │ ├── json.go │ │ │ ├── mask_test.go │ │ │ ├── prepared_test.go │ │ │ ├── compression_test.go │ │ │ ├── client_test.go │ │ │ ├── json_test.go │ │ │ ├── util_test.go │ │ │ └── prepared.go │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── doc │ │ │ └── README.md │ │ │ ├── https │ │ │ ├── acme │ │ │ │ ├── utils.go │ │ │ │ ├── challenges.go │ │ │ │ ├── LICENSE │ │ │ │ ├── http_challenge.go │ │ │ │ ├── provider.go │ │ │ │ ├── tls_sni_challenge_server.go │ │ │ │ ├── error.go │ │ │ │ ├── tls_sni_challenge.go │ │ │ │ ├── jws.go │ │ │ │ └── http_challenge_server.go │ │ │ ├── jose │ │ │ │ ├── doc.go │ │ │ │ ├── utils.go │ │ │ │ └── cipher │ │ │ │ │ ├── concat_kdf.go │ │ │ │ │ ├── ecdh_es.go │ │ │ │ │ └── key_wrap.go │ │ │ ├── https_test.go │ │ │ ├── letsencrypt │ │ │ │ └── LICENSE │ │ │ └── net │ │ │ │ └── context │ │ │ │ └── go17.go │ │ │ ├── main.go │ │ │ ├── test.sh │ │ │ ├── LICENSE │ │ │ ├── sip │ │ │ ├── sip_test.go │ │ │ ├── example_test.go │ │ │ └── sip.go │ │ │ ├── turn │ │ │ ├── turn_test.go │ │ │ ├── example_test.go │ │ │ └── turn.go │ │ │ ├── amf0 │ │ │ └── example_test.go │ │ │ ├── avc │ │ │ └── example_test.go │ │ │ ├── rtmp │ │ │ └── example_test.go │ │ │ ├── logger │ │ │ ├── logger_test.go │ │ │ ├── pre_go17.go │ │ │ ├── go17.go │ │ │ ├── example_test.go │ │ │ └── example_go17_test.go │ │ │ ├── options │ │ │ ├── options_test.go │ │ │ ├── example_test.go │ │ │ └── options.go │ │ │ ├── errors │ │ │ ├── bench_test.go │ │ │ ├── LICENSE │ │ │ └── README.md │ │ │ ├── main_test.go │ │ │ ├── kxps │ │ │ ├── doc.go │ │ │ ├── example_test.go │ │ │ ├── krps.go │ │ │ └── kbps.go │ │ │ ├── asprocess │ │ │ └── example_test.go │ │ │ ├── aac │ │ │ └── example_test.go │ │ │ ├── flv │ │ │ └── example_test.go │ │ │ ├── http │ │ │ └── api.go │ │ │ ├── README.md │ │ │ └── json │ │ │ └── example_test.go │ │ └── satori │ │ └── go.uuid │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── sql.go │ │ └── uuid_test.go ├── images │ ├── app-ok.png │ └── app-failed.png ├── Gopkg.toml ├── README.md └── Gopkg.lock ├── java ├── images │ ├── app-ok.png │ └── app-failed.png ├── README.md └── pom.xml ├── php ├── images │ ├── app-ok.png │ └── app-failed.png ├── README.md └── app │ └── v1 │ └── login.php ├── ruby ├── images │ ├── app-ok.png │ └── app-failed.png ├── README.md └── server.rb ├── csharp ├── images │ ├── app-ok.png │ └── app-failed.png ├── rtc-app-csharp │ └── rtc-app-csharp.csproj ├── README.md └── rtc-app-csharp.sln ├── nodejs ├── images │ ├── app-ok.png │ └── app-failed.png ├── package.json ├── README.md ├── package-lock.json └── index.js ├── python ├── CherryPy-3.2.2.zip ├── images │ ├── app-ok.png │ └── app-failed.png └── README.md ├── .gitignore ├── LICENSE └── README.md /verify/html/js/README.md: -------------------------------------------------------------------------------- 1 | All js/css files. 2 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /java/images/app-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/java/images/app-ok.png -------------------------------------------------------------------------------- /php/images/app-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/php/images/app-ok.png -------------------------------------------------------------------------------- /ruby/images/app-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/ruby/images/app-ok.png -------------------------------------------------------------------------------- /csharp/images/app-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/csharp/images/app-ok.png -------------------------------------------------------------------------------- /golang/images/app-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/golang/images/app-ok.png -------------------------------------------------------------------------------- /nodejs/images/app-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/nodejs/images/app-ok.png -------------------------------------------------------------------------------- /php/images/app-failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/php/images/app-failed.png -------------------------------------------------------------------------------- /python/CherryPy-3.2.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/python/CherryPy-3.2.2.zip -------------------------------------------------------------------------------- /python/images/app-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/python/images/app-ok.png -------------------------------------------------------------------------------- /java/images/app-failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/java/images/app-failed.png -------------------------------------------------------------------------------- /ruby/images/app-failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/ruby/images/app-failed.png -------------------------------------------------------------------------------- /csharp/images/app-failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/csharp/images/app-failed.png -------------------------------------------------------------------------------- /golang/images/app-failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/golang/images/app-failed.png -------------------------------------------------------------------------------- /nodejs/images/app-failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/nodejs/images/app-failed.png -------------------------------------------------------------------------------- /python/images/app-failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/python/images/app-failed.png -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | build 3 | gradle* 4 | local.* 5 | 6 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GMORYX 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | csharp/.vs/ 4 | csharp/aliyun-openapi-net-sdk/ 5 | csharp/rtc-app-csharp/bin/ 6 | csharp/rtc-app-csharp/obj/ 7 | csharp/rtc-app-csharp/rtc-app-csharp.csproj.user 8 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Gorilla WebSocket authors for copyright 2 | # purposes. 3 | # 4 | # Please keep the list sorted. 5 | 6 | Gary Burd 7 | Joachim Bauch 8 | 9 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /verify/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SIBI 5 | 8 | 9 | 10 |

Let's SIBI~

11 | 12 | 13 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliRtcAppServer/HEAD/golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | - 1.7 6 | - 1.8 7 | 8 | before_install: 9 | - go get -t -v ./... 10 | 11 | script: 12 | - bash test.sh 13 | 14 | after_success: 15 | - bash <(curl -s https://codecov.io/bash) 16 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /csharp/rtc-app-csharp/rtc-app-csharp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.1 6 | rtc_app_csharp 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | *.aar 6 | 7 | # Folders 8 | _obj 9 | _test 10 | .idea 11 | .gradle 12 | 13 | # Architecture specific extensions/prefixes 14 | *.[568vq] 15 | [568vq].out 16 | 17 | *.cgo1.go 18 | *.cgo2.c 19 | _cgo_defun.c 20 | _cgo_gotypes.go 21 | _cgo_export.* 22 | 23 | _testmain.go 24 | 25 | *.exe 26 | *.test 27 | *.prof 28 | 29 | # Coverage files 30 | *.txt 31 | 32 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/mask_safe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of 2 | // this source code is governed by a BSD-style license that can be found in the 3 | // LICENSE file. 4 | 5 | // +build appengine 6 | 7 | // fork from https://github.com/gorilla/websocket 8 | package websocket 9 | 10 | func maskBytes(key [4]byte, pos int, b []byte) int { 11 | for i := range b { 12 | b[i] ^= key[pos&3] 13 | pos++ 14 | } 15 | return pos & 3 16 | } 17 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /golang/vendor/github.com/satori/go.uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - 1.2 5 | - 1.3 6 | - 1.4 7 | - 1.5 8 | - 1.6 9 | - 1.7 10 | - 1.8 11 | - 1.9 12 | - tip 13 | matrix: 14 | allow_failures: 15 | - go: tip 16 | fast_finish: true 17 | before_install: 18 | - go get github.com/mattn/goveralls 19 | - go get golang.org/x/tools/cmd/cover 20 | script: 21 | - $HOME/gopath/bin/goveralls -service=travis-ci 22 | notifications: 23 | email: false 24 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/client_clone.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.8 6 | 7 | // fork from https://github.com/gorilla/websocket 8 | package websocket 9 | 10 | import "crypto/tls" 11 | 12 | func cloneTLSConfig(cfg *tls.Config) *tls.Config { 13 | if cfg == nil { 14 | return &tls.Config{} 15 | } 16 | return cfg.Clone() 17 | } 18 | -------------------------------------------------------------------------------- /verify/html/js/talks.css: -------------------------------------------------------------------------------- 1 | /* Footer 2 | -------------------------------------------------- */ 3 | .footer { 4 | text-align: center; 5 | padding: 30px 0; 6 | margin-top: 10px; 7 | border-top: 1px solid #e5e5e5; 8 | background-color: #f5f5f5; 9 | } 10 | .footer p { 11 | margin-bottom: 0; 12 | color: #777; 13 | } 14 | .footer-links { 15 | margin: 10px 0; 16 | } 17 | .footer-links li { 18 | display: inline; 19 | padding: 0 2px; 20 | } 21 | .footer-links li:first-child { 22 | padding-left: 0; 23 | } 24 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/conn_read.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.5 6 | 7 | // fork from https://github.com/gorilla/websocket 8 | package websocket 9 | 10 | import "io" 11 | 12 | func (c *Conn) read(n int) ([]byte, error) { 13 | p, err := c.br.Peek(n) 14 | if err == io.EOF { 15 | err = errUnexpectedEOF 16 | } 17 | c.br.Discard(len(p)) 18 | return p, err 19 | } 20 | -------------------------------------------------------------------------------- /golang/Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/conn_read_legacy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.5 6 | 7 | // fork from https://github.com/gorilla/websocket 8 | package websocket 9 | 10 | import "io" 11 | 12 | func (c *Conn) read(n int) ([]byte, error) { 13 | p, err := c.br.Peek(n) 14 | if err == io.EOF { 15 | err = errUnexpectedEOF 16 | } 17 | if len(p) > 0 { 18 | // advance over the bytes just read 19 | io.ReadFull(c.br, p) 20 | } 21 | return p, err 22 | } 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rtc-app-nodejs", 3 | "version": "1.0.0", 4 | "description": "Nodejs AppServer for RTC.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/winlinvip/rtc-app-nodejs.git" 12 | }, 13 | "author": "", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/winlinvip/rtc-app-nodejs/issues" 17 | }, 18 | "homepage": "https://github.com/winlinvip/rtc-app-nodejs#readme", 19 | "dependencies": { 20 | "uuid": "^3.3.2", 21 | "sha256": "^0.2.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/doc/README.md: -------------------------------------------------------------------------------- 1 | # DOC 2 | 3 | The documents refered by this project: 4 | 5 | 1. [rtmp_specification_1.0.pdf](https://github.com/ossrs/srs/blob/2.0release/trunk/doc/rtmp_specification_1.0.pdf) 6 | 1. [amf0_spec_121207.pdf](https://github.com/ossrs/srs/blob/2.0release/trunk/doc/amf0_spec_121207.pdf) 7 | 1. [video_file_format_spec_v10.pdf](https://github.com/ossrs/srs/blob/2.0release/trunk/doc/video_file_format_spec_v10_1.pdf) 8 | 1. [ISO_IEC_14496-3-AAC-2001.pdf](https://github.com/ossrs/srs/blob/2.0release/trunk/doc/ISO_IEC_14496-3-AAC-2001.pdf) 9 | 1. [ISO_IEC_13818-7-AAC-2004.pdf](https://github.com/ossrs/srs/blob/2.0release/trunk/doc/ISO_IEC_13818-7-AAC-2004.pdf) 10 | 1. [RFC3261](https://www.ietf.org/rfc/rfc3261.txt), SIP(Session Initiation Protocol) 11 | -------------------------------------------------------------------------------- /csharp/README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | C# AppServer for RTC. 4 | 5 | ## Usage 6 | 7 | 1. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 8 | 9 | ``` 10 | AppID: xxxxxxxx 11 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 12 | ``` 13 | 14 | 2. Run project with args(replace appid and appkey with yours): 15 | 16 | ``` 17 | --listen=8080 --appid=xxxxxxxx --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --gslb=https://rgslb.rtc.aliyuncs.com 18 | ``` 19 | 20 | 3. Verify your AppServer by [VerifyServer](../verify/README.md). 21 | 22 | ![AppServer Success](images/app-ok.png) 23 | 24 | ![AppServer Failed](images/app-failed.png) 25 | 26 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 27 | 28 | > Remark: Please use your AppServer IP instead by `ifconfig eth0`. 29 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/utils.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import ( 6 | "fmt" 7 | "time" 8 | ) 9 | 10 | // WaitFor polls the given function 'f', once every 'interval', up to 'timeout'. 11 | func WaitFor(timeout, interval time.Duration, f func() (bool, error)) error { 12 | var lastErr string 13 | timeup := time.After(timeout) 14 | for { 15 | select { 16 | case <-timeup: 17 | return fmt.Errorf("Time limit exceeded. Last error: %s", lastErr) 18 | default: 19 | } 20 | 21 | stop, err := f() 22 | if stop { 23 | return nil 24 | } 25 | if err != nil { 26 | lastErr = err.Error() 27 | } 28 | 29 | time.Sleep(interval) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /csharp/rtc-app-csharp.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "rtc-app-csharp", "rtc-app-csharp\rtc-app-csharp.csproj", "{853CA45E-8388-4CB6-BB50-8C73D4819464}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {853CA45E-8388-4CB6-BB50-8C73D4819464}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {853CA45E-8388-4CB6-BB50-8C73D4819464}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {853CA45E-8388-4CB6-BB50-8C73D4819464}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {853CA45E-8388-4CB6-BB50-8C73D4819464}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /java/README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | Java AppServer for RTC. 4 | 5 | ## Usage 6 | 7 | 1. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 8 | 9 | ``` 10 | AppID: xxxxxxxx 11 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 12 | ``` 13 | 14 | 2. Build project with maven, for example, [JetBrains IDEA](https://www.jetbrains.com/idea/download/#section=mac). 15 | 16 | 3. Run project with args(replace appid and appkey with yours): 17 | 18 | ``` 19 | --listen=8080 --appid=xxxxxxxx --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 20 | --gslb=https://rgslb.rtc.aliyuncs.com 21 | ``` 22 | 23 | 4. Verify your AppServer by [VerifyServer](../verify/README.md). 24 | 25 | ![AppServer Success](images/app-ok.png) 26 | 27 | ![AppServer Failed](images/app-failed.png) 28 | 29 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 30 | 31 | > Remark: Please use your AppServer IP instead by `ifconfig eth0`. 32 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /golang/README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | Golang AppServer for RTC. 4 | 5 | ## Usage 6 | 7 | 1. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 8 | 9 | ``` 10 | AppID: xxxxxxxx 11 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 12 | ``` 13 | 14 | 2. Setup Golang environment, click [here](https://blog.csdn.net/win_lin/article/details/48265493). 15 | 16 | 17 | 3. Run project with args(replace appid and appkey with yours): 18 | 19 | ``` 20 | go run main.go --listen=8080 --appid=xxxxxxxx \ 21 | --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --gslb=https://rgslb.rtc.aliyuncs.com 22 | ``` 23 | 24 | 4. Verify your AppServer by [VerifyServer](../verify/README.md). 25 | 26 | ![AppServer Success](images/app-ok.png) 27 | 28 | ![AppServer Failed](images/app-failed.png) 29 | 30 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 31 | 32 | > Remark: Please use your AppServer IP instead by `ifconfig eth0`. 33 | 34 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/main.go: -------------------------------------------------------------------------------- 1 | // Please use library. 2 | package main 3 | 4 | import ( 5 | "fmt" 6 | _ "github.com/ossrs/go-oryx-lib/aac" 7 | _ "github.com/ossrs/go-oryx-lib/asprocess" 8 | _ "github.com/ossrs/go-oryx-lib/errors" 9 | _ "github.com/ossrs/go-oryx-lib/flv" 10 | _ "github.com/ossrs/go-oryx-lib/gmoryx" 11 | _ "github.com/ossrs/go-oryx-lib/http" 12 | _ "github.com/ossrs/go-oryx-lib/https" 13 | _ "github.com/ossrs/go-oryx-lib/json" 14 | _ "github.com/ossrs/go-oryx-lib/kxps" 15 | _ "github.com/ossrs/go-oryx-lib/logger" 16 | _ "github.com/ossrs/go-oryx-lib/options" 17 | _ "github.com/ossrs/go-oryx-lib/websocket" 18 | ) 19 | 20 | const ( 21 | Major, Minor, Revision = 0, 0, 1 22 | ) 23 | 24 | func Version() string { 25 | return fmt.Sprintf("%v.%v.%v", Major, Minor, Revision) 26 | } 27 | 28 | func main() { 29 | fmt.Println(fmt.Sprintf("GO-ORYX-LIB/%v, please use as library in your project.", Version())) 30 | return 31 | } 32 | -------------------------------------------------------------------------------- /php/README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | PHP AppServer for RTC. 4 | 5 | ## Usage 6 | 7 | 1. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 8 | 9 | ``` 10 | AppID: xxxxxxxx 11 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 12 | ``` 13 | 14 | 2. Create Config.php by your data: 15 | 16 | ``` 17 | echo " Config.php 18 | echo "\$listen = 8080;" >> Config.php 19 | echo "\$app_id = 'xxxxxxxx'; " >> Config.php 20 | echo "\$app_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; " >> Config.php 21 | echo "\$gslb = 'https://rgslb.rtc.aliyuncs.com'; " >> Config.php 22 | echo "?>" >> Config.php 23 | ``` 24 | 25 | 3. Verify your AppServer by [VerifyServer](../verify/README.md). 26 | 27 | ![AppServer Success](images/app-ok.png) 28 | 29 | ![AppServer Failed](images/app-failed.png) 30 | 31 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 32 | 33 | > Remark: Please use your AppServer IP instead by `ifconfig eth0`. 34 | 35 | -------------------------------------------------------------------------------- /golang/Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | digest = "1:123fa087d9773527c9ac5f934b1192989c646e0e722abd547dbbdc4209a37a4f" 6 | name = "github.com/ossrs/go-oryx-lib" 7 | packages = [ 8 | "http", 9 | "logger", 10 | ] 11 | pruneopts = "" 12 | revision = "223f7f8586fd18a400248500fd6aabcd7abeb5fb" 13 | version = "v0.0.4" 14 | 15 | [[projects]] 16 | digest = "1:7f569d906bdd20d906b606415b7d794f798f91a62fcfb6a4daa6d50690fb7a3f" 17 | name = "github.com/satori/go.uuid" 18 | packages = ["."] 19 | pruneopts = "" 20 | revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3" 21 | version = "v1.2.0" 22 | 23 | [solve-meta] 24 | analyzer-name = "dep" 25 | analyzer-version = 1 26 | input-imports = [ 27 | "github.com/ossrs/go-oryx-lib/http", 28 | "github.com/ossrs/go-oryx-lib/logger", 29 | "github.com/satori/go.uuid", 30 | ] 31 | solver-name = "gps-cdcl" 32 | solver-version = 1 33 | -------------------------------------------------------------------------------- /ruby/README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | Ruby AppServer for RTC. 4 | 5 | ## Usage 6 | 7 | 1. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 8 | 9 | ``` 10 | AppID: xxxxxxxx 11 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 12 | ``` 13 | 14 | 2. Setup Ruby environment, click [here](https://ruby-china.org/wiki/rvm-guide). 15 | 16 | install sinatra gem 17 | ``` 18 | gem install sinatra 19 | ``` 20 | 21 | 22 | 3. Run project with args(replace appid and appkey with yours): 23 | 24 | ``` 25 | ruby server.rb --listen=8080 --appid=xxxxxxxx \ 26 | --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --gslb=https://rgslb.rtc.aliyuncs.com 27 | ``` 28 | 29 | 4. Verify your AppServer by [VerifyServer](../verify/README.md). 30 | 31 | ![AppServer Success](images/app-ok.png) 32 | 33 | ![AppServer Failed](images/app-failed.png) 34 | 35 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 36 | 37 | > Remark: Please use your AppServer IP instead by `ifconfig eth0`. 38 | 39 | -------------------------------------------------------------------------------- /nodejs/README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | Nodejs AppServer for RTC. 4 | 5 | 6 | ## Usage 7 | 8 | 1. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 9 | 10 | ``` 11 | AppID: xxxxxxxx 12 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 13 | ``` 14 | 15 | 2. Clone project and generate config: 16 | 17 | ``` 18 | npm install && 19 | echo "module.exports = {" > config.js && 20 | echo " listen: 8080," >> config.js && 21 | echo " appId: 'xxxxxxxx'," >> config.js && 22 | echo " appKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'," >> config.js && 23 | echo " gslb: 'https://rgslb.rtc.aliyuncs.com'" >> config.js && 24 | echo "};" >> config.js && 25 | node index.js 26 | ``` 27 | 28 | 3. Verify your AppServer by [VerifyServer](../verify/README.md). 29 | 30 | ![AppServer Success](images/app-ok.png) 31 | 32 | ![AppServer Failed](images/app-failed.png) 33 | 34 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 35 | 36 | > Remark: Please use your AppServer IP instead by `ifconfig eth0`. 37 | 38 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | go test -race -v ./... 4 | ret=$?; if [[ $ret -ne 0 && $ret -ne 1 ]]; then 5 | echo "Test failed, exit $ret" 6 | exit $ret 7 | fi 8 | 9 | echo "mode: atomic" > coverage.txt 10 | 11 | function coverage() { 12 | go test $1 -race -coverprofile=tmp.txt -covermode=atomic 13 | ret=$?; if [[ $ret -eq 0 ]]; then 14 | cat tmp.txt >> coverage.txt 15 | rm -f tmp.txt 16 | fi 17 | } 18 | 19 | coverage github.com/ossrs/go-oryx-lib/aac 20 | coverage github.com/ossrs/go-oryx-lib/amf0 21 | coverage github.com/ossrs/go-oryx-lib/asprocess 22 | coverage github.com/ossrs/go-oryx-lib/avc 23 | coverage github.com/ossrs/go-oryx-lib/flv 24 | coverage github.com/ossrs/go-oryx-lib/http 25 | coverage github.com/ossrs/go-oryx-lib/https 26 | coverage github.com/ossrs/go-oryx-lib/json 27 | coverage github.com/ossrs/go-oryx-lib/kxps 28 | coverage github.com/ossrs/go-oryx-lib/logger 29 | coverage github.com/ossrs/go-oryx-lib/options 30 | coverage github.com/ossrs/go-oryx-lib/rtmp 31 | -------------------------------------------------------------------------------- /verify/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: UTF-8 -*- 3 | 4 | import sys, os, cherrypy 5 | from optparse import OptionParser 6 | 7 | parser = OptionParser() 8 | parser.add_option("-a", "--listen", dest="listen", help="Listen port") 9 | 10 | (options, args) = parser.parse_args() 11 | listen = options.listen 12 | 13 | if listen == None: 14 | print "Usage: %s <--listen=Listen>"%(sys.argv[0]) 15 | print " --listen Server listen port" 16 | print "For example:" 17 | print " %s --listen=8080"%(sys.argv[0]) 18 | sys.exit(-1) 19 | 20 | root_path = os.path.abspath(os.path.dirname(__file__)) + "/html/" 21 | 22 | print "Listen=%s Path=%s"%(listen, root_path) 23 | 24 | conf = { 25 | 'global': { 26 | 'server.socket_host': '0.0.0.0', 27 | 'server.socket_port': int(listen) 28 | }, 29 | '/': { 30 | 'tools.staticdir.on': True, 31 | 'tools.staticdir.dir': root_path, 32 | 'tools.staticdir.index': 'index.html', 33 | } 34 | } 35 | 36 | class Root(object): pass 37 | cherrypy.quickstart(Root(), '/', conf) 38 | -------------------------------------------------------------------------------- /java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | jetbrains 8 | maven-rtc 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 13 | com.sun.net.httpserver 14 | http 15 | 20070405 16 | test 17 | 18 | 19 | commons-cli 20 | commons-cli 21 | 1.2 22 | 23 | 24 | org.json 25 | json 26 | 20170516 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 aliyunvideo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/challenges.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | // Challenge is a string that identifies a particular type and version of ACME challenge. 6 | type Challenge string 7 | 8 | const ( 9 | // HTTP01 is the "http-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#http 10 | // Note: HTTP01ChallengePath returns the URL path to fulfill this challenge 11 | HTTP01 = Challenge("http-01") 12 | // TLSSNI01 is the "tls-sni-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#tls-with-server-name-indication-tls-sni 13 | // Note: TLSSNI01ChallengeCert returns a certificate to fulfill this challenge 14 | TLSSNI01 = Challenge("tls-sni-01") 15 | // DNS01 is the "dns-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#dns 16 | // Note: DNS01Record returns a DNS record which will fulfill this challenge 17 | DNS01 = Challenge("dns-01") 18 | ) 19 | -------------------------------------------------------------------------------- /nodejs/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rtc-app-nodejs", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "convert-hex": { 8 | "version": "0.1.0", 9 | "resolved": "https://registry.npmjs.org/convert-hex/-/convert-hex-0.1.0.tgz", 10 | "integrity": "sha1-CMBFaJIsJ3drii6BqV05M2LqC2U=" 11 | }, 12 | "convert-string": { 13 | "version": "0.1.0", 14 | "resolved": "https://registry.npmjs.org/convert-string/-/convert-string-0.1.0.tgz", 15 | "integrity": "sha1-ec5BqbsNA7z3LNxqjzxW+7xkQQo=" 16 | }, 17 | "sha256": { 18 | "version": "0.2.0", 19 | "resolved": "https://registry.npmjs.org/sha256/-/sha256-0.2.0.tgz", 20 | "integrity": "sha1-c6C0GNqrcDW/+G6EkeNjQS/CqwU=", 21 | "requires": { 22 | "convert-hex": "~0.1.0", 23 | "convert-string": "~0.1.0" 24 | } 25 | }, 26 | "uuid": { 27 | "version": "3.3.2", 28 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", 29 | "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /golang/vendor/github.com/satori/go.uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2018 by Maxim Bublis 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2017 winlin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/AndroidHTTPServer/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "org.ossrs.gmoryx.example.httpd" 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | repositories { 23 | flatDir { 24 | dirs 'libs' 25 | } 26 | } 27 | 28 | dependencies { 29 | compile(name: 'gmoryx', ext: 'aar') 30 | compile fileTree(dir: 'libs', include: ['*.jar']) 31 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 32 | exclude group: 'com.android.support', module: 'support-annotations' 33 | }) 34 | compile 'com.android.support:appcompat-v7:25.2.0' 35 | testCompile 'junit:junit:4.12' 36 | } 37 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Sebastian Erhart 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/jose/doc.go: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2014 Square Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | 19 | Package jose aims to provide an implementation of the Javascript Object Signing 20 | and Encryption set of standards. For the moment, it mainly focuses on 21 | encryption and signing based on the JSON Web Encryption and JSON Web Signature 22 | standards. The library supports both the compact and full serialization 23 | formats, and has optional support for multiple recipients. 24 | 25 | */ 26 | // from gopkg.in/square/go-jose.v1 27 | package jose // import "github.com/ossrs/go-oryx-lib/https/jose" 28 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/sip/sip_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package sip 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/turn/turn_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package turn 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/amf0/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package amf0_test 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/avc/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package avc_test 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/rtmp/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package rtmp_test 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/sip/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package sip_test 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/turn/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package turn_test 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/sip/sip.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The oryx sip package support SIP protocol. 23 | package sip 24 | -------------------------------------------------------------------------------- /verify/html/js/bravo_alert/demo/demo_alert_simple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bravo alert 6 | 7 | 8 | 9 |
10 |

bravo alert simple demo

11 |

1. 简单的显示警告框内容

12 |
13 | Hi, penny! you have a alert to show some msgs here. 14 |
15 |

2. 将data-dismiss="alert"添加到关闭按钮,即可赋予某个警告框关闭的功能。

16 |
17 | 18 | Holy guacamole! Best check yo self, you're not looking too good. 19 |
20 |
21 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/turn/turn.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The oryx turn package support TURN protocol. 23 | package turn 24 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/https_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package https 23 | 24 | import "testing" 25 | 26 | func TestHttps(t *testing.T) { 27 | } 28 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/logger/logger_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package logger 23 | 24 | import "testing" 25 | 26 | func TestLogger(t *testing.T) { 27 | } 28 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/options/options_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package options 23 | 24 | import "testing" 25 | 26 | func TestOptions(t *testing.T) { 27 | } 28 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/errors/bench_test.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package errors 4 | 5 | import ( 6 | "fmt" 7 | "testing" 8 | 9 | stderrors "errors" 10 | ) 11 | 12 | func noErrors(at, depth int) error { 13 | if at >= depth { 14 | return stderrors.New("no error") 15 | } 16 | return noErrors(at+1, depth) 17 | } 18 | 19 | func yesErrors(at, depth int) error { 20 | if at >= depth { 21 | return New("ye error") 22 | } 23 | return yesErrors(at+1, depth) 24 | } 25 | 26 | // GlobalE is an exported global to store the result of benchmark results, 27 | // preventing the compiler from optimising the benchmark functions away. 28 | var GlobalE error 29 | 30 | func BenchmarkErrors(b *testing.B) { 31 | type run struct { 32 | stack int 33 | std bool 34 | } 35 | runs := []run{ 36 | {10, false}, 37 | {10, true}, 38 | {100, false}, 39 | {100, true}, 40 | {1000, false}, 41 | {1000, true}, 42 | } 43 | for _, r := range runs { 44 | part := "pkg/errors" 45 | if r.std { 46 | part = "errors" 47 | } 48 | name := fmt.Sprintf("%s-stack-%d", part, r.stack) 49 | b.Run(name, func(b *testing.B) { 50 | var err error 51 | f := yesErrors 52 | if r.std { 53 | f = noErrors 54 | } 55 | b.ReportAllocs() 56 | for i := 0; i < b.N; i++ { 57 | err = f(0, r.stack) 58 | } 59 | b.StopTimer() 60 | GlobalE = err 61 | }) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/http_challenge.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import ( 6 | "fmt" 7 | "log" 8 | ) 9 | 10 | type httpChallenge struct { 11 | jws *jws 12 | validate validateFunc 13 | provider ChallengeProvider 14 | } 15 | 16 | // HTTP01ChallengePath returns the URL path for the `http-01` challenge 17 | func HTTP01ChallengePath(token string) string { 18 | return "/.well-known/acme-challenge/" + token 19 | } 20 | 21 | func (s *httpChallenge) Solve(chlng challenge, domain string) error { 22 | 23 | logf("[INFO][%s] acme: Trying to solve HTTP-01", domain) 24 | 25 | // Generate the Key Authorization for the challenge 26 | keyAuth, err := getKeyAuthorization(chlng.Token, s.jws.privKey) 27 | if err != nil { 28 | return err 29 | } 30 | 31 | err = s.provider.Present(domain, chlng.Token, keyAuth) 32 | if err != nil { 33 | return fmt.Errorf("[%s] error presenting token: %v", domain, err) 34 | } 35 | defer func() { 36 | err := s.provider.CleanUp(domain, chlng.Token, keyAuth) 37 | if err != nil { 38 | log.Printf("[%s] error cleaning up: %v", domain, err) 39 | } 40 | }() 41 | 42 | return s.validate(s.jws, domain, chlng.URI, challenge{Resource: "challenge", Type: chlng.Type, Token: chlng.Token, KeyAuthorization: keyAuth}) 43 | } 44 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/errors/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/provider.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import "time" 6 | 7 | // ChallengeProvider enables implementing a custom challenge 8 | // provider. Present presents the solution to a challenge available to 9 | // be solved. CleanUp will be called by the challenge if Present ends 10 | // in a non-error state. 11 | type ChallengeProvider interface { 12 | Present(domain, token, keyAuth string) error 13 | CleanUp(domain, token, keyAuth string) error 14 | } 15 | 16 | // ChallengeProviderTimeout allows for implementing a 17 | // ChallengeProvider where an unusually long timeout is required when 18 | // waiting for an ACME challenge to be satisfied, such as when 19 | // checking for DNS record progagation. If an implementor of a 20 | // ChallengeProvider provides a Timeout method, then the return values 21 | // of the Timeout method will be used when appropriate by the acme 22 | // package. The interval value is the time between checks. 23 | // 24 | // The default values used for timeout and interval are 60 seconds and 25 | // 2 seconds respectively. These are used when no Timeout method is 26 | // defined for the ChallengeProvider. 27 | type ChallengeProviderTimeout interface { 28 | ChallengeProvider 29 | Timeout() (timeout, interval time.Duration) 30 | } 31 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/main_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package main 23 | 24 | import ( 25 | "os" 26 | "testing" 27 | ) 28 | 29 | func TestDemo(t *testing.T) { 30 | } 31 | 32 | func TestMain(m *testing.M) { 33 | os.Exit(m.Run()) 34 | } 35 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/kxps/doc.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The oryx kxps package provides some kxps, for example: 23 | // N kbps, N k bits per seconds 24 | // N krps, N k requests per seconds 25 | // over some duration for instance 10s, 30s, 5m, average. 26 | package kxps 27 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/mask.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of 2 | // this source code is governed by a BSD-style license that can be found in the 3 | // LICENSE file. 4 | 5 | // +build !appengine 6 | 7 | // fork from https://github.com/gorilla/websocket 8 | package websocket 9 | 10 | import "unsafe" 11 | 12 | const wordSize = int(unsafe.Sizeof(uintptr(0))) 13 | 14 | func maskBytes(key [4]byte, pos int, b []byte) int { 15 | 16 | // Mask one byte at a time for small buffers. 17 | if len(b) < 2*wordSize { 18 | for i := range b { 19 | b[i] ^= key[pos&3] 20 | pos++ 21 | } 22 | return pos & 3 23 | } 24 | 25 | // Mask one byte at a time to word boundary. 26 | if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 { 27 | n = wordSize - n 28 | for i := range b[:n] { 29 | b[i] ^= key[pos&3] 30 | pos++ 31 | } 32 | b = b[n:] 33 | } 34 | 35 | // Create aligned word size key. 36 | var k [wordSize]byte 37 | for i := range k { 38 | k[i] = key[(pos+i)&3] 39 | } 40 | kw := *(*uintptr)(unsafe.Pointer(&k)) 41 | 42 | // Mask one word at a time. 43 | n := (len(b) / wordSize) * wordSize 44 | for i := 0; i < n; i += wordSize { 45 | *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw 46 | } 47 | 48 | // Mask one byte at a time for remaining bytes. 49 | b = b[n:] 50 | for i := range b { 51 | b[i] ^= key[pos&3] 52 | pos++ 53 | } 54 | 55 | return pos & 3 56 | } 57 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/http.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The gmoryx(gomobile oryx APIs) http package exported for mobile. 23 | package gmoryx 24 | 25 | import ( 26 | oh "github.com/ossrs/go-oryx-lib/http" 27 | "net/http" 28 | ) 29 | 30 | func SetServer(server string) { 31 | oh.Server = server 32 | } 33 | 34 | func SetHeader(w HttpResponseWriter) { 35 | oh.SetHeader(w.(http.ResponseWriter)) 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | Select example by your programing languages: 4 | 5 | * [Golang](golang#appserver) 6 | * [Java](java#appserver) 7 | * [Python](python#appserver) 8 | * [C#](csharp#appserver) 9 | * [Nodejs](nodejs#appserver) 10 | * [PHP](php#appserver) 11 | 12 | We release it at [RTC AppServer Demo](https://github.com/aliyunvideo/AliRtcAppServer). 13 | 14 | ## Workflow 15 | 16 | For RTC deverloper: 17 | 18 | * RTC [workflow](https://help.aliyun.com/document_detail/74889.html). 19 | * RTC [token generation](https://help.aliyun.com/document_detail/74890.html). 20 | 21 | ## OpenAPI 22 | 23 | Use OpenAPI to create channel: 24 | 25 | * Golang: https://help.aliyun.com/document_detail/74890.html#channel-golang 26 | * Java: https://help.aliyun.com/document_detail/74890.html#channel-java 27 | * Python: https://help.aliyun.com/document_detail/74890.html#channel-python 28 | * C#: https://help.aliyun.com/document_detail/74890.html#channel-csharp 29 | * Nodejs: https://help.aliyun.com/document_detail/74890.html#channel-nodejs 30 | * PHP: https://help.aliyun.com/document_detail/74890.html#channel-php 31 | 32 | ## Algorithm 33 | 34 | Token generation algorithm: 35 | 36 | * Golang: https://help.aliyun.com/document_detail/74890.html#token-golang 37 | * Java: https://help.aliyun.com/document_detail/74890.html#token-java 38 | * Python: https://help.aliyun.com/document_detail/74890.html#token-python 39 | * C#: https://help.aliyun.com/document_detail/74890.html#token-csharp 40 | * Nodejs: https://help.aliyun.com/document_detail/74890.html#token-nodejs 41 | * PHP: https://help.aliyun.com/document_detail/74890.html#token-php 42 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/logger/pre_go17.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // +build !go1.7 23 | 24 | package logger 25 | 26 | func (v *loggerPlus) Println(ctx Context, a ...interface{}) { 27 | args := v.format(ctx, a...) 28 | v.doPrintln(args...) 29 | } 30 | 31 | func (v *loggerPlus) Printf(ctx Context, format string, a ...interface{}) { 32 | format, args := v.formatf(ctx, format, a...) 33 | v.doPrintf(format, args...) 34 | } 35 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket_test 7 | 8 | import ( 9 | "log" 10 | "net/http" 11 | "testing" 12 | 13 | "github.com/ossrs/go-oryx-lib/websocket" 14 | ) 15 | 16 | var ( 17 | c *websocket.Conn 18 | req *http.Request 19 | ) 20 | 21 | // The websocket.IsUnexpectedCloseError function is useful for identifying 22 | // application and protocol errors. 23 | // 24 | // This server application works with a client application running in the 25 | // browser. The client application does not explicitly close the websocket. The 26 | // only expected close message from the client has the code 27 | // websocket.CloseGoingAway. All other other close messages are likely the 28 | // result of an application or protocol error and are logged to aid debugging. 29 | func ExampleIsUnexpectedCloseError() { 30 | 31 | for { 32 | messageType, p, err := c.ReadMessage() 33 | if err != nil { 34 | if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) { 35 | log.Printf("error: %v, user-agent: %v", err, req.Header.Get("User-Agent")) 36 | } 37 | return 38 | } 39 | processMesage(messageType, p) 40 | } 41 | } 42 | 43 | func processMesage(mt int, p []byte) {} 44 | 45 | // TestX prevents godoc from showing this entire file in the example. Remove 46 | // this function when a second example is added. 47 | func TestX(t *testing.T) {} 48 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/letsencrypt/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/client_clone_legacy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.8 6 | 7 | // fork from https://github.com/gorilla/websocket 8 | package websocket 9 | 10 | import "crypto/tls" 11 | 12 | // cloneTLSConfig clones all public fields except the fields 13 | // SessionTicketsDisabled and SessionTicketKey. This avoids copying the 14 | // sync.Mutex in the sync.Once and makes it safe to call cloneTLSConfig on a 15 | // config in active use. 16 | func cloneTLSConfig(cfg *tls.Config) *tls.Config { 17 | if cfg == nil { 18 | return &tls.Config{} 19 | } 20 | return &tls.Config{ 21 | Rand: cfg.Rand, 22 | Time: cfg.Time, 23 | Certificates: cfg.Certificates, 24 | NameToCertificate: cfg.NameToCertificate, 25 | GetCertificate: cfg.GetCertificate, 26 | RootCAs: cfg.RootCAs, 27 | NextProtos: cfg.NextProtos, 28 | ServerName: cfg.ServerName, 29 | ClientAuth: cfg.ClientAuth, 30 | ClientCAs: cfg.ClientCAs, 31 | InsecureSkipVerify: cfg.InsecureSkipVerify, 32 | CipherSuites: cfg.CipherSuites, 33 | PreferServerCipherSuites: cfg.PreferServerCipherSuites, 34 | ClientSessionCache: cfg.ClientSessionCache, 35 | MinVersion: cfg.MinVersion, 36 | MaxVersion: cfg.MaxVersion, 37 | CurvePreferences: cfg.CurvePreferences, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/server_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket 7 | 8 | import ( 9 | "net/http" 10 | "reflect" 11 | "testing" 12 | ) 13 | 14 | var subprotocolTests = []struct { 15 | h string 16 | protocols []string 17 | }{ 18 | {"", nil}, 19 | {"foo", []string{"foo"}}, 20 | {"foo,bar", []string{"foo", "bar"}}, 21 | {"foo, bar", []string{"foo", "bar"}}, 22 | {" foo, bar", []string{"foo", "bar"}}, 23 | {" foo, bar ", []string{"foo", "bar"}}, 24 | } 25 | 26 | func TestSubprotocols(t *testing.T) { 27 | for _, st := range subprotocolTests { 28 | r := http.Request{Header: http.Header{"Sec-Websocket-Protocol": {st.h}}} 29 | protocols := Subprotocols(&r) 30 | if !reflect.DeepEqual(st.protocols, protocols) { 31 | t.Errorf("SubProtocols(%q) returned %#v, want %#v", st.h, protocols, st.protocols) 32 | } 33 | } 34 | } 35 | 36 | var isWebSocketUpgradeTests = []struct { 37 | ok bool 38 | h http.Header 39 | }{ 40 | {false, http.Header{"Upgrade": {"websocket"}}}, 41 | {false, http.Header{"Connection": {"upgrade"}}}, 42 | {true, http.Header{"Connection": {"upgRade"}, "Upgrade": {"WebSocket"}}}, 43 | } 44 | 45 | func TestIsWebSocketUpgrade(t *testing.T) { 46 | for _, tt := range isWebSocketUpgradeTests { 47 | ok := IsWebSocketUpgrade(&http.Request{Header: tt.h}) 48 | if tt.ok != ok { 49 | t.Errorf("IsWebSocketUpgrade(%v) returned %v, want %v", tt.h, ok, tt.ok) 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/README.md: -------------------------------------------------------------------------------- 1 | # GMORYX 2 | 3 | The GMORYX(GOMOBILE ORYX) is a API adapter to use [go-oryx-lib](https://github.com/ossrs/go-oryx-lib) 4 | in Android or iOS. 5 | 6 | - [x] AndroidHTTPServer, The HTTP server example for Android. 7 | 8 | ## GOMOBILE 9 | 10 | To setup the [gomobile](https://github.com/golang/go/wiki/Mobile), 11 | please read [blog post](http://blog.csdn.net/win_lin/article/details/60956485). 12 | 13 | The Go mobile subrepository adds support for mobile platforms (Android and iOS) 14 | and provides tools to build mobile applications. 15 | 16 | There are two strategies you can follow to include Go into your mobile stack: 17 | 18 | - Writing all-Go native mobile applications. 19 | - Writing SDK applications by generating bindings from a Go package and invoke them 20 | from Java (on Android) and Objective-C (on iOS). 21 | 22 | For more information, please read [wiki](https://github.com/golang/go/wiki/Mobile) 23 | and [repository](https://github.com/golang/mobile). 24 | 25 | ## AndroidHTTPServer 26 | 27 | First of all, please build the library `gmoryx.aar` by: 28 | 29 | ``` 30 | cd $GOPATH/src/github.com/ossrs/go-oryx-lib/gmoryx && 31 | mkdir -p AndroidHTTPServer/app/libs && 32 | gomobile bind -target=android -o AndroidHTTPServer/app/libs/gmoryx.aar 33 | ``` 34 | 35 | > Remark: Read [GOMOBILE](#gomobile) to setup environment. 36 | 37 | Open this project in AndroidStudio, run in Android phone, which will start a web server: 38 | 39 | ![GMOryx on Android](https://cloud.githubusercontent.com/assets/2777660/23847853/4abcce20-080f-11e7-83e3-3e12cae4dda3.png) 40 | 41 | Access the web server: 42 | 43 | ![Firefox Client](https://cloud.githubusercontent.com/assets/2777660/23847860/52d54010-080f-11e7-8c97-4f8901aa4b35.png) 44 | 45 | Winlin, 2017 46 | 47 | 48 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/options/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package options_test 23 | 24 | import ( 25 | "fmt" 26 | oo "github.com/ossrs/go-oryx-lib/options" 27 | "os" 28 | ) 29 | 30 | func ExampleOptions() { 31 | var err error 32 | 33 | // Parse config file from argv: 34 | // ./binary -c file 35 | // ./binary -c conf/oryx.json 36 | configFile := oo.ParseArgv("conf/console.json", "1.0", "GoOryx/1.0") 37 | 38 | var f *os.File 39 | if f, err = os.Open(configFile); err != nil { 40 | fmt.Println("Open config file failed, err is", err) 41 | return 42 | } 43 | defer f.Close() 44 | 45 | // Use the config file. 46 | _ = f 47 | } 48 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/json.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket 7 | 8 | import ( 9 | "encoding/json" 10 | "io" 11 | ) 12 | 13 | // WriteJSON writes the JSON encoding of v as a message. 14 | // 15 | // Deprecated: Use c.WriteJSON instead. 16 | func WriteJSON(c *Conn, v interface{}) error { 17 | return c.WriteJSON(v) 18 | } 19 | 20 | // WriteJSON writes the JSON encoding of v as a message. 21 | // 22 | // See the documentation for encoding/json Marshal for details about the 23 | // conversion of Go values to JSON. 24 | func (c *Conn) WriteJSON(v interface{}) error { 25 | w, err := c.NextWriter(TextMessage) 26 | if err != nil { 27 | return err 28 | } 29 | err1 := json.NewEncoder(w).Encode(v) 30 | err2 := w.Close() 31 | if err1 != nil { 32 | return err1 33 | } 34 | return err2 35 | } 36 | 37 | // ReadJSON reads the next JSON-encoded message from the connection and stores 38 | // it in the value pointed to by v. 39 | // 40 | // Deprecated: Use c.ReadJSON instead. 41 | func ReadJSON(c *Conn, v interface{}) error { 42 | return c.ReadJSON(v) 43 | } 44 | 45 | // ReadJSON reads the next JSON-encoded message from the connection and stores 46 | // it in the value pointed to by v. 47 | // 48 | // See the documentation for the encoding/json Unmarshal function for details 49 | // about the conversion of JSON to a Go value. 50 | func (c *Conn) ReadJSON(v interface{}) error { 51 | _, r, err := c.NextReader() 52 | if err != nil { 53 | return err 54 | } 55 | err = json.NewDecoder(r).Decode(v) 56 | if err == io.EOF { 57 | // One value is expected in the message. 58 | err = io.ErrUnexpectedEOF 59 | } 60 | return err 61 | } 62 | -------------------------------------------------------------------------------- /verify/html/js/bravo_alert/alert.js: -------------------------------------------------------------------------------- 1 | angular.module('bravoUiAlert', []) 2 | .directive('bravoAlert', function () { 3 | return { 4 | restrict: "A", 5 | transclude: true, 6 | template: '
', 7 | scope: { 8 | alert_show: '=alertShow', 9 | on_close: '&bravoAlertClose', 10 | on_closed: '&bravoAlertClosed' 11 | }, 12 | compile: function (elem, attr) { 13 | var manual = attr['alertShow']; 14 | return function (scope, elem, attr) { 15 | elem.on('click', function(event) { 16 | var obj = angular.element(event.target); 17 | if (obj.attr('data-dismiss')) { 18 | scope.on_destory(); 19 | } 20 | }); 21 | scope.on_destory = function () { 22 | if (!manual) { 23 | scope.on_close(); 24 | elem.addClass('ng-hide'); 25 | scope.on_closed(); 26 | } else { 27 | scope.on_close(); 28 | scope.alert_show = false; 29 | scope.$apply(); 30 | } 31 | }; 32 | scope.$watch('alert_show', function (nv, ov) { 33 | if (nv != ov) { 34 | if (!nv) { 35 | elem.addClass('ng-hide'); 36 | scope.on_closed(); 37 | } else { 38 | elem.removeClass('ng-hide'); 39 | } 40 | } 41 | }); 42 | } 43 | } 44 | } 45 | }); 46 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/tls_sni_challenge_server.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import ( 6 | "crypto/tls" 7 | "fmt" 8 | "net" 9 | "net/http" 10 | ) 11 | 12 | // TLSProviderServer implements ChallengeProvider for `TLS-SNI-01` challenge 13 | // It may be instantiated without using the NewTLSProviderServer function if 14 | // you want only to use the default values. 15 | type TLSProviderServer struct { 16 | iface string 17 | port string 18 | done chan bool 19 | listener net.Listener 20 | } 21 | 22 | // NewTLSProviderServer creates a new TLSProviderServer on the selected interface and port. 23 | // Setting iface and / or port to an empty string will make the server fall back to 24 | // the "any" interface and port 443 respectively. 25 | func NewTLSProviderServer(iface, port string) *TLSProviderServer { 26 | return &TLSProviderServer{iface: iface, port: port} 27 | } 28 | 29 | // Present makes the keyAuth available as a cert 30 | func (s *TLSProviderServer) Present(domain, token, keyAuth string) error { 31 | if s.port == "" { 32 | s.port = "443" 33 | } 34 | 35 | cert, err := TLSSNI01ChallengeCert(keyAuth) 36 | if err != nil { 37 | return err 38 | } 39 | 40 | tlsConf := new(tls.Config) 41 | tlsConf.Certificates = []tls.Certificate{cert} 42 | 43 | s.listener, err = tls.Listen("tcp", net.JoinHostPort(s.iface, s.port), tlsConf) 44 | if err != nil { 45 | return fmt.Errorf("Could not start HTTPS server for challenge -> %v", err) 46 | } 47 | 48 | s.done = make(chan bool) 49 | go func() { 50 | http.Serve(s.listener, nil) 51 | s.done <- true 52 | }() 53 | return nil 54 | } 55 | 56 | // CleanUp closes the HTTP server. 57 | func (s *TLSProviderServer) CleanUp(domain, token, keyAuth string) error { 58 | if s.listener == nil { 59 | return nil 60 | } 61 | s.listener.Close() 62 | <-s.done 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/kxps/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package kxps_test 23 | 24 | import ( 25 | "github.com/ossrs/go-oryx-lib/kxps" 26 | ) 27 | 28 | func ExampleKrps() { 29 | // user must provides the krps source 30 | var source kxps.KrpsSource 31 | 32 | krps := kxps.NewKrps(nil, source) 33 | defer krps.Close() 34 | 35 | if err := krps.Start(); err != nil { 36 | return 37 | } 38 | 39 | _ = krps.Average() 40 | _ = krps.Rps10s() 41 | _ = krps.Rps30s() 42 | _ = krps.Rps300s() 43 | } 44 | 45 | func ExampleKbps() { 46 | // user must provides the kbps source 47 | var source kxps.KbpsSource 48 | 49 | kbps := kxps.NewKbps(nil, source) 50 | defer kbps.Close() 51 | 52 | if err := kbps.Start(); err != nil { 53 | return 54 | } 55 | 56 | _ = kbps.Average() 57 | _ = kbps.Kbps10s() 58 | _ = kbps.Kbps30s() 59 | _ = kbps.Kbps300s() 60 | } 61 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/mask_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of 2 | // this source code is governed by a BSD-style license that can be found in the 3 | // LICENSE file. 4 | 5 | // Require 1.7 for sub-bencmarks 6 | // +build go1.7,!appengine 7 | 8 | // fork from https://github.com/gorilla/websocket 9 | package websocket 10 | 11 | import ( 12 | "fmt" 13 | "testing" 14 | ) 15 | 16 | func maskBytesByByte(key [4]byte, pos int, b []byte) int { 17 | for i := range b { 18 | b[i] ^= key[pos&3] 19 | pos++ 20 | } 21 | return pos & 3 22 | } 23 | 24 | func notzero(b []byte) int { 25 | for i := range b { 26 | if b[i] != 0 { 27 | return i 28 | } 29 | } 30 | return -1 31 | } 32 | 33 | func TestMaskBytes(t *testing.T) { 34 | key := [4]byte{1, 2, 3, 4} 35 | for size := 1; size <= 1024; size++ { 36 | for align := 0; align < wordSize; align++ { 37 | for pos := 0; pos < 4; pos++ { 38 | b := make([]byte, size+align)[align:] 39 | maskBytes(key, pos, b) 40 | maskBytesByByte(key, pos, b) 41 | if i := notzero(b); i >= 0 { 42 | t.Errorf("size:%d, align:%d, pos:%d, offset:%d", size, align, pos, i) 43 | } 44 | } 45 | } 46 | } 47 | } 48 | 49 | func BenchmarkMaskBytes(b *testing.B) { 50 | for _, size := range []int{2, 4, 8, 16, 32, 512, 1024} { 51 | b.Run(fmt.Sprintf("size-%d", size), func(b *testing.B) { 52 | for _, align := range []int{wordSize / 2} { 53 | b.Run(fmt.Sprintf("align-%d", align), func(b *testing.B) { 54 | for _, fn := range []struct { 55 | name string 56 | fn func(key [4]byte, pos int, b []byte) int 57 | }{ 58 | {"byte", maskBytesByByte}, 59 | {"word", maskBytes}, 60 | } { 61 | b.Run(fn.name, func(b *testing.B) { 62 | key := newMaskKey() 63 | data := make([]byte, size+align)[align:] 64 | for i := 0; i < b.N; i++ { 65 | fn.fn(key, 0, data) 66 | } 67 | b.SetBytes(int64(len(data))) 68 | }) 69 | } 70 | }) 71 | } 72 | }) 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/asprocess/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package asprocess_test 23 | 24 | import ( 25 | oa "github.com/ossrs/go-oryx-lib/asprocess" 26 | "os" 27 | "os/signal" 28 | "syscall" 29 | ) 30 | 31 | func ExampleAsProcess() { 32 | // Without context and callback. 33 | oa.Watch(nil, oa.CheckParentInterval, nil) 34 | 35 | // Without context, use callback to cleanup. 36 | oa.Watch(nil, oa.CheckParentInterval, oa.Cleanup(func() { 37 | // Do cleanup when quit. 38 | })) 39 | } 40 | 41 | func ExampleAsProcess_NoQuit() { 42 | // User control the quit event. 43 | q := make(chan bool, 1) 44 | oa.WatchNoExit(nil, oa.CheckParentInterval, q) 45 | 46 | // Quit when parent changed or signals. 47 | c := make(chan os.Signal) 48 | signal.Notify(c, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL) 49 | 50 | select { 51 | case <-q: 52 | // Quit for parent changed. 53 | case <-c: 54 | // Quit for signal. 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/jose/utils.go: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2014 Square Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // from gopkg.in/square/go-jose.v1 18 | package jose 19 | 20 | import ( 21 | "crypto/x509" 22 | "encoding/pem" 23 | "fmt" 24 | ) 25 | 26 | // LoadPublicKey loads a public key from PEM/DER-encoded data. 27 | func LoadPublicKey(data []byte) (interface{}, error) { 28 | input := data 29 | 30 | block, _ := pem.Decode(data) 31 | if block != nil { 32 | input = block.Bytes 33 | } 34 | 35 | // Try to load SubjectPublicKeyInfo 36 | pub, err0 := x509.ParsePKIXPublicKey(input) 37 | if err0 == nil { 38 | return pub, nil 39 | } 40 | 41 | cert, err1 := x509.ParseCertificate(input) 42 | if err1 == nil { 43 | return cert.PublicKey, nil 44 | } 45 | 46 | return nil, fmt.Errorf("square/go-jose: parse error, got '%s' and '%s'", err0, err1) 47 | } 48 | 49 | // LoadPrivateKey loads a private key from PEM/DER-encoded data. 50 | func LoadPrivateKey(data []byte) (interface{}, error) { 51 | input := data 52 | 53 | block, _ := pem.Decode(data) 54 | if block != nil { 55 | input = block.Bytes 56 | } 57 | 58 | var priv interface{} 59 | priv, err0 := x509.ParsePKCS1PrivateKey(input) 60 | if err0 == nil { 61 | return priv, nil 62 | } 63 | 64 | priv, err1 := x509.ParsePKCS8PrivateKey(input) 65 | if err1 == nil { 66 | return priv, nil 67 | } 68 | 69 | priv, err2 := x509.ParseECPrivateKey(input) 70 | if err2 == nil { 71 | return priv, nil 72 | } 73 | 74 | return nil, fmt.Errorf("square/go-jose: parse error, got '%s', '%s' and '%s'", err0, err1, err2) 75 | } 76 | -------------------------------------------------------------------------------- /golang/vendor/github.com/satori/go.uuid/README.md: -------------------------------------------------------------------------------- 1 | # UUID package for Go language 2 | 3 | [![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) 4 | [![Coverage Status](https://coveralls.io/repos/github/satori/go.uuid/badge.svg?branch=master)](https://coveralls.io/github/satori/go.uuid) 5 | [![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) 6 | 7 | This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. 8 | 9 | With 100% test coverage and benchmarks out of box. 10 | 11 | Supported versions: 12 | * Version 1, based on timestamp and MAC address (RFC 4122) 13 | * Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) 14 | * Version 3, based on MD5 hashing (RFC 4122) 15 | * Version 4, based on random numbers (RFC 4122) 16 | * Version 5, based on SHA-1 hashing (RFC 4122) 17 | 18 | ## Installation 19 | 20 | Use the `go` command: 21 | 22 | $ go get github.com/satori/go.uuid 23 | 24 | ## Requirements 25 | 26 | UUID package requires Go >= 1.2. 27 | 28 | ## Example 29 | 30 | ```go 31 | package main 32 | 33 | import ( 34 | "fmt" 35 | "github.com/satori/go.uuid" 36 | ) 37 | 38 | func main() { 39 | // Creating UUID Version 4 40 | u1 := uuid.NewV4() 41 | fmt.Printf("UUIDv4: %s\n", u1) 42 | 43 | // Parsing UUID from string input 44 | u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") 45 | if err != nil { 46 | fmt.Printf("Something gone wrong: %s", err) 47 | } 48 | fmt.Printf("Successfully parsed: %s", u2) 49 | } 50 | ``` 51 | 52 | ## Documentation 53 | 54 | [Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. 55 | 56 | ## Links 57 | * [RFC 4122](http://tools.ietf.org/html/rfc4122) 58 | * [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) 59 | 60 | ## Copyright 61 | 62 | Copyright (C) 2013-2018 by Maxim Bublis . 63 | 64 | UUID package released under MIT License. 65 | See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. 66 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/jose/cipher/concat_kdf.go: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2014 Square Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // from gopkg.in/square/go-jose.v1/cipher 18 | package josecipher 19 | 20 | import ( 21 | "crypto" 22 | "encoding/binary" 23 | "hash" 24 | "io" 25 | ) 26 | 27 | type concatKDF struct { 28 | z, info []byte 29 | i uint32 30 | cache []byte 31 | hasher hash.Hash 32 | } 33 | 34 | // NewConcatKDF builds a KDF reader based on the given inputs. 35 | func NewConcatKDF(hash crypto.Hash, z, algID, ptyUInfo, ptyVInfo, supPubInfo, supPrivInfo []byte) io.Reader { 36 | buffer := make([]byte, uint64(len(algID))+uint64(len(ptyUInfo))+uint64(len(ptyVInfo))+uint64(len(supPubInfo))+uint64(len(supPrivInfo))) 37 | n := 0 38 | n += copy(buffer, algID) 39 | n += copy(buffer[n:], ptyUInfo) 40 | n += copy(buffer[n:], ptyVInfo) 41 | n += copy(buffer[n:], supPubInfo) 42 | copy(buffer[n:], supPrivInfo) 43 | 44 | hasher := hash.New() 45 | 46 | return &concatKDF{ 47 | z: z, 48 | info: buffer, 49 | hasher: hasher, 50 | cache: []byte{}, 51 | i: 1, 52 | } 53 | } 54 | 55 | func (ctx *concatKDF) Read(out []byte) (int, error) { 56 | copied := copy(out, ctx.cache) 57 | ctx.cache = ctx.cache[copied:] 58 | 59 | for copied < len(out) { 60 | ctx.hasher.Reset() 61 | 62 | // Write on a hash.Hash never fails 63 | _ = binary.Write(ctx.hasher, binary.BigEndian, ctx.i) 64 | _, _ = ctx.hasher.Write(ctx.z) 65 | _, _ = ctx.hasher.Write(ctx.info) 66 | 67 | hash := ctx.hasher.Sum(nil) 68 | chunkCopied := copy(out[copied:], hash) 69 | copied += chunkCopied 70 | ctx.cache = hash[chunkCopied:] 71 | 72 | ctx.i++ 73 | } 74 | 75 | return copied, nil 76 | } 77 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/error.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import ( 6 | "encoding/json" 7 | "fmt" 8 | "net/http" 9 | "strings" 10 | ) 11 | 12 | const ( 13 | tosAgreementError = "Must agree to subscriber agreement before any further actions" 14 | ) 15 | 16 | // RemoteError is the base type for all errors specific to the ACME protocol. 17 | type RemoteError struct { 18 | StatusCode int `json:"status,omitempty"` 19 | Type string `json:"type"` 20 | Detail string `json:"detail"` 21 | } 22 | 23 | func (e RemoteError) Error() string { 24 | return fmt.Sprintf("acme: Error %d - %s - %s", e.StatusCode, e.Type, e.Detail) 25 | } 26 | 27 | // TOSError represents the error which is returned if the user needs to 28 | // accept the TOS. 29 | // TODO: include the new TOS url if we can somehow obtain it. 30 | type TOSError struct { 31 | RemoteError 32 | } 33 | 34 | type domainError struct { 35 | Domain string 36 | Error error 37 | } 38 | 39 | type challengeError struct { 40 | RemoteError 41 | records []validationRecord 42 | } 43 | 44 | func (c challengeError) Error() string { 45 | 46 | var errStr string 47 | for _, validation := range c.records { 48 | errStr = errStr + fmt.Sprintf("\tValidation for %s:%s\n\tResolved to:\n\t\t%s\n\tUsed: %s\n\n", 49 | validation.Hostname, validation.Port, strings.Join(validation.ResolvedAddresses, "\n\t\t"), validation.UsedAddress) 50 | } 51 | 52 | return fmt.Sprintf("%s\nError Detail:\n%s", c.RemoteError.Error(), errStr) 53 | } 54 | 55 | func handleHTTPError(resp *http.Response) error { 56 | var errorDetail RemoteError 57 | decoder := json.NewDecoder(resp.Body) 58 | err := decoder.Decode(&errorDetail) 59 | if err != nil { 60 | return err 61 | } 62 | 63 | errorDetail.StatusCode = resp.StatusCode 64 | 65 | // Check for errors we handle specifically 66 | if errorDetail.StatusCode == http.StatusForbidden && errorDetail.Detail == tosAgreementError { 67 | return TOSError{errorDetail} 68 | } 69 | 70 | return errorDetail 71 | } 72 | 73 | func handleChallengeError(chlng challenge) error { 74 | return challengeError{chlng.Error, chlng.ValidationRecords} 75 | } 76 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/prepared_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket 7 | 8 | import ( 9 | "bytes" 10 | "compress/flate" 11 | "math/rand" 12 | "testing" 13 | ) 14 | 15 | var preparedMessageTests = []struct { 16 | messageType int 17 | isServer bool 18 | enableWriteCompression bool 19 | compressionLevel int 20 | }{ 21 | // Server 22 | {TextMessage, true, false, flate.BestSpeed}, 23 | {TextMessage, true, true, flate.BestSpeed}, 24 | {TextMessage, true, true, flate.BestCompression}, 25 | {PingMessage, true, false, flate.BestSpeed}, 26 | {PingMessage, true, true, flate.BestSpeed}, 27 | 28 | // Client 29 | {TextMessage, false, false, flate.BestSpeed}, 30 | {TextMessage, false, true, flate.BestSpeed}, 31 | {TextMessage, false, true, flate.BestCompression}, 32 | {PingMessage, false, false, flate.BestSpeed}, 33 | {PingMessage, false, true, flate.BestSpeed}, 34 | } 35 | 36 | func TestPreparedMessage(t *testing.T) { 37 | for _, tt := range preparedMessageTests { 38 | var data = []byte("this is a test") 39 | var buf bytes.Buffer 40 | c := newConn(fakeNetConn{Reader: nil, Writer: &buf}, tt.isServer, 1024, 1024) 41 | if tt.enableWriteCompression { 42 | c.newCompressionWriter = compressNoContextTakeover 43 | } 44 | c.SetCompressionLevel(tt.compressionLevel) 45 | 46 | // Seed random number generator for consistent frame mask. 47 | rand.Seed(1234) 48 | 49 | if err := c.WriteMessage(tt.messageType, data); err != nil { 50 | t.Fatal(err) 51 | } 52 | want := buf.String() 53 | 54 | pm, err := NewPreparedMessage(tt.messageType, data) 55 | if err != nil { 56 | t.Fatal(err) 57 | } 58 | 59 | // Scribble on data to ensure that NewPreparedMessage takes a snapshot. 60 | copy(data, "hello world") 61 | 62 | // Seed random number generator for consistent frame mask. 63 | rand.Seed(1234) 64 | 65 | buf.Reset() 66 | if err := c.WritePreparedMessage(pm); err != nil { 67 | t.Fatal(err) 68 | } 69 | got := buf.String() 70 | 71 | if got != want { 72 | t.Errorf("write message != prepared message for %+v", tt) 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/compression_test.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/gorilla/websocket 2 | package websocket 3 | 4 | import ( 5 | "bytes" 6 | "fmt" 7 | "io" 8 | "io/ioutil" 9 | "testing" 10 | ) 11 | 12 | type nopCloser struct{ io.Writer } 13 | 14 | func (nopCloser) Close() error { return nil } 15 | 16 | func TestTruncWriter(t *testing.T) { 17 | const data = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijlkmnopqrstuvwxyz987654321" 18 | for n := 1; n <= 10; n++ { 19 | var b bytes.Buffer 20 | w := &truncWriter{w: nopCloser{&b}} 21 | p := []byte(data) 22 | for len(p) > 0 { 23 | m := len(p) 24 | if m > n { 25 | m = n 26 | } 27 | w.Write(p[:m]) 28 | p = p[m:] 29 | } 30 | if b.String() != data[:len(data)-len(w.p)] { 31 | t.Errorf("%d: %q", n, b.String()) 32 | } 33 | } 34 | } 35 | 36 | func textMessages(num int) [][]byte { 37 | messages := make([][]byte, num) 38 | for i := 0; i < num; i++ { 39 | msg := fmt.Sprintf("planet: %d, country: %d, city: %d, street: %d", i, i, i, i) 40 | messages[i] = []byte(msg) 41 | } 42 | return messages 43 | } 44 | 45 | func BenchmarkWriteNoCompression(b *testing.B) { 46 | w := ioutil.Discard 47 | c := newConn(fakeNetConn{Reader: nil, Writer: w}, false, 1024, 1024) 48 | messages := textMessages(100) 49 | b.ResetTimer() 50 | for i := 0; i < b.N; i++ { 51 | c.WriteMessage(TextMessage, messages[i%len(messages)]) 52 | } 53 | b.ReportAllocs() 54 | } 55 | 56 | func BenchmarkWriteWithCompression(b *testing.B) { 57 | w := ioutil.Discard 58 | c := newConn(fakeNetConn{Reader: nil, Writer: w}, false, 1024, 1024) 59 | messages := textMessages(100) 60 | c.enableWriteCompression = true 61 | c.newCompressionWriter = compressNoContextTakeover 62 | b.ResetTimer() 63 | for i := 0; i < b.N; i++ { 64 | c.WriteMessage(TextMessage, messages[i%len(messages)]) 65 | } 66 | b.ReportAllocs() 67 | } 68 | 69 | func TestValidCompressionLevel(t *testing.T) { 70 | c := newConn(fakeNetConn{}, false, 1024, 1024) 71 | for _, level := range []int{minCompressionLevel - 1, maxCompressionLevel + 1} { 72 | if err := c.SetCompressionLevel(level); err == nil { 73 | t.Errorf("no error for level %d", level) 74 | } 75 | } 76 | for _, level := range []int{minCompressionLevel, maxCompressionLevel} { 77 | if err := c.SetCompressionLevel(level); err != nil { 78 | t.Errorf("error for level %d", level) 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /verify/html/ng_index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RTC 6 | 7 | 8 | 13 | 14 | 15 | 30 |
31 |
32 |
33 | 34 | {{log.level}}: {{log.msg}} 35 |
36 |
37 |
38 |
39 |

Talks © Team 2018

40 |
41 |
42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/jose/cipher/ecdh_es.go: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2014 Square Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // from gopkg.in/square/go-jose.v1/cipher 18 | package josecipher 19 | 20 | import ( 21 | "crypto" 22 | "crypto/ecdsa" 23 | "encoding/binary" 24 | ) 25 | 26 | // DeriveECDHES derives a shared encryption key using ECDH/ConcatKDF as described in JWE/JWA. 27 | // It is an error to call this function with a private/public key that are not on the same 28 | // curve. Callers must ensure that the keys are valid before calling this function. Output 29 | // size may be at most 1<<16 bytes (64 KiB). 30 | func DeriveECDHES(alg string, apuData, apvData []byte, priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey, size int) []byte { 31 | if size > 1<<16 { 32 | panic("ECDH-ES output size too large, must be less than 1<<16") 33 | } 34 | 35 | // algId, partyUInfo, partyVInfo inputs must be prefixed with the length 36 | algID := lengthPrefixed([]byte(alg)) 37 | ptyUInfo := lengthPrefixed(apuData) 38 | ptyVInfo := lengthPrefixed(apvData) 39 | 40 | // suppPubInfo is the encoded length of the output size in bits 41 | supPubInfo := make([]byte, 4) 42 | binary.BigEndian.PutUint32(supPubInfo, uint32(size)*8) 43 | 44 | if !priv.PublicKey.Curve.IsOnCurve(pub.X, pub.Y) { 45 | panic("public key not on same curve as private key") 46 | } 47 | 48 | z, _ := priv.PublicKey.Curve.ScalarMult(pub.X, pub.Y, priv.D.Bytes()) 49 | reader := NewConcatKDF(crypto.SHA256, z.Bytes(), algID, ptyUInfo, ptyVInfo, supPubInfo, []byte{}) 50 | 51 | key := make([]byte, size) 52 | 53 | // Read on the KDF will never fail 54 | _, _ = reader.Read(key) 55 | return key 56 | } 57 | 58 | func lengthPrefixed(data []byte) []byte { 59 | out := make([]byte, len(data)+4) 60 | binary.BigEndian.PutUint32(out, uint32(len(data))) 61 | copy(out[4:], data) 62 | return out 63 | } 64 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/errors/README.md: -------------------------------------------------------------------------------- 1 | # errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) 2 | 3 | Package errors provides simple error handling primitives. 4 | 5 | `go get github.com/pkg/errors` 6 | 7 | The traditional error handling idiom in Go is roughly akin to 8 | ```go 9 | if err != nil { 10 | return err 11 | } 12 | ``` 13 | which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. 14 | 15 | ## Adding context to an error 16 | 17 | The errors.Wrap function returns a new error that adds context to the original error. For example 18 | ```go 19 | _, err := ioutil.ReadAll(r) 20 | if err != nil { 21 | return errors.Wrap(err, "read failed") 22 | } 23 | ``` 24 | ## Retrieving the cause of an error 25 | 26 | Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. 27 | ```go 28 | type causer interface { 29 | Cause() error 30 | } 31 | ``` 32 | `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: 33 | ```go 34 | switch err := errors.Cause(err).(type) { 35 | case *MyError: 36 | // handle specifically 37 | default: 38 | // unknown error 39 | } 40 | ``` 41 | 42 | [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). 43 | 44 | ## Contributing 45 | 46 | We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. 47 | 48 | Before proposing a change, please discuss your change by raising an issue. 49 | 50 | ## Licence 51 | 52 | BSD-2-Clause 53 | -------------------------------------------------------------------------------- /verify/README.md: -------------------------------------------------------------------------------- 1 | # AppServer Token Verify 2 | 3 | AppServer Token Verify for AliRTC. 4 | 5 | ## CentOS6 6 | 7 | 1. Setup Python: 8 | 9 | ``` 10 | (pip --version 2>/dev/null || sudo yum install -y python-pip) && 11 | (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) 12 | ``` 13 | 14 | 2. Start AppServer Verify Server: 15 | 16 | ``` 17 | ./server.py --listen=9000 18 | ``` 19 | 20 | 3. Verify your AppServer by [here](http://127.0.0.1:9000/ng_index.html#/rtc-check?schema=http&host=127.0.0.1&port=8080&path=/app/v1/login&room=1237&user=jzufp&password=12345678). 21 | 22 | 4. Verify your Token by [verify token](http://127.0.0.1:9000/ng_index.html#/token-check). 23 | 24 | 25 | ## MacPro 26 | 27 | 1. Install `pip` for Python: 28 | 29 | ``` 30 | pip --version 2>/dev/null || sudo easy_install pip 31 | ``` 32 | 33 | or 34 | 35 | ``` 36 | url='https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz#sha256=f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68' && 37 | pip --version 2>/dev/null || (wget $url -O pip-10.0.1.tar.gz 38 | tar xf pip-10.0.1.tar.gz && cd pip-10.0.1 && 39 | sudo python setup.py install) 40 | ``` 41 | 42 | 2. Setup Python: 43 | 44 | ``` 45 | (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) 46 | ``` 47 | 48 | 3. Start AppServer Verify Server: 49 | 50 | ``` 51 | ./server.py --listen=9000 52 | ``` 53 | 54 | 4. Verify your AppServer by [here](http://127.0.0.1:9000/ng_index.html#/rtc-check?schema=http&host=127.0.0.1&port=8080&path=/app/v1/login&room=1237&user=jzufp&password=12345678). 55 | 56 | 5. Verify your Token by [verify token](http://127.0.0.1:9000/ng_index.html#/token-check). 57 | 58 | 59 | ## Windows 60 | 61 | 1. Unzip `CherryPy-3.2.2.zip` then install by: 62 | 63 | ``` 64 | cd CherryPy-3.2.2 65 | python setup.py install --user 66 | ``` 67 | 68 | 2. Download `pycryptodome` from [here](https://pypi.org/project/pycryptodome/#files), then unzip and install by: 69 | 70 | ``` 71 | cd pycryptodome-* 72 | python setup.py install --user 73 | ``` 74 | 75 | 3. Start AppServer Verify Server: 76 | 77 | ``` 78 | ./server.py --listen=9000 79 | ``` 80 | 81 | 4. Verify your AppServer by [here](http://127.0.0.1:9000/ng_index.html#/rtc-check?schema=http&host=127.0.0.1&port=8080&path=/app/v1/login&room=1237&user=jzufp&password=12345678). 82 | 83 | 5. Verify your Token by [verify token](http://127.0.0.1:9000/ng_index.html#/token-check). 84 | 85 | -------------------------------------------------------------------------------- /verify/html/js/bravo_alert/demo/demo_alert_senior.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bravo alert 6 | 7 | 8 | 9 |
10 |

bravo alert senior demo

11 |
12 |

指令外部控制alert的显示与关闭

13 |

alert-show="your_scope_controller_variable"添加到attr。

14 |
15 |
17 |

Oh snap! You got an error!

18 |

Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

19 |
20 | 21 | 22 |
23 | 24 | 25 | 43 | 44 | -------------------------------------------------------------------------------- /php/app/v1/login.php: -------------------------------------------------------------------------------- 1 | 0, 59 | 'data' => array( 60 | 'appid' => $app_id, 61 | 'userid' => $user_id, 62 | 'gslb' => array($gslb), 63 | 'token' => $token, 64 | 'nonce' => $nonce, 65 | 'timestamp' => $timestamp, 66 | 'turn' => array( 67 | 'username' => $username, 68 | 'password' => $token 69 | ) 70 | ) 71 | )); 72 | ?> 73 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/aac/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package aac_test 23 | 24 | import ( 25 | "fmt" 26 | "github.com/ossrs/go-oryx-lib/aac" 27 | ) 28 | 29 | func ExampleAdts_Decode() { 30 | var err error 31 | var adts aac.ADTS 32 | if adts, err = aac.NewADTS(); err != nil { 33 | fmt.Println(fmt.Sprintf("APP: Create ADTS failed, err is %+v", err)) 34 | return 35 | } 36 | 37 | var data []byte // Read ADTS data from file or network. 38 | 39 | // Ignore the left, assume that the RAW only contains one AAC frame. 40 | var raw []byte 41 | if raw, _, err = adts.Decode(data); err != nil { 42 | fmt.Println(fmt.Sprintf("APP: ADTS decode failed, err is %+v", err)) 43 | return 44 | } 45 | 46 | // Use the RAW data. 47 | _ = raw 48 | 49 | // Use the asc object, for example, used as RTMP audio sequence header. 50 | _ = adts.ASC() 51 | } 52 | 53 | func ExampleAdts_Encode() { 54 | var err error 55 | var adts aac.ADTS 56 | if adts, err = aac.NewADTS(); err != nil { 57 | fmt.Println(fmt.Sprintf("APP: Create ADTS failed, err is %+v", err)) 58 | return 59 | } 60 | 61 | var raw []byte // Read RAW AAC from file or network. 62 | var data []byte 63 | if data, err = adts.Encode(raw); err != nil { 64 | fmt.Println(fmt.Sprintf("APP: ADTS encode failed, err is %+v", err)) 65 | return 66 | } 67 | 68 | // Use the ADTS data. 69 | _ = data 70 | } 71 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/tls_sni_challenge.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import ( 6 | "crypto/rsa" 7 | "crypto/sha256" 8 | "crypto/tls" 9 | "encoding/hex" 10 | "fmt" 11 | "log" 12 | ) 13 | 14 | type tlsSNIChallenge struct { 15 | jws *jws 16 | validate validateFunc 17 | provider ChallengeProvider 18 | } 19 | 20 | func (t *tlsSNIChallenge) Solve(chlng challenge, domain string) error { 21 | // FIXME: https://github.com/ietf-wg-acme/acme/pull/22 22 | // Currently we implement this challenge to track boulder, not the current spec! 23 | 24 | logf("[INFO][%s] acme: Trying to solve TLS-SNI-01", domain) 25 | 26 | // Generate the Key Authorization for the challenge 27 | keyAuth, err := getKeyAuthorization(chlng.Token, t.jws.privKey) 28 | if err != nil { 29 | return err 30 | } 31 | 32 | err = t.provider.Present(domain, chlng.Token, keyAuth) 33 | if err != nil { 34 | return fmt.Errorf("[%s] error presenting token: %v", domain, err) 35 | } 36 | defer func() { 37 | err := t.provider.CleanUp(domain, chlng.Token, keyAuth) 38 | if err != nil { 39 | log.Printf("[%s] error cleaning up: %v", domain, err) 40 | } 41 | }() 42 | return t.validate(t.jws, domain, chlng.URI, challenge{Resource: "challenge", Type: chlng.Type, Token: chlng.Token, KeyAuthorization: keyAuth}) 43 | } 44 | 45 | // TLSSNI01ChallengeCert returns a certificate and target domain for the `tls-sni-01` challenge 46 | func TLSSNI01ChallengeCertDomain(keyAuth string) (tls.Certificate, string, error) { 47 | // generate a new RSA key for the certificates 48 | tempPrivKey, err := generatePrivateKey(RSA2048) 49 | if err != nil { 50 | return tls.Certificate{}, "", err 51 | } 52 | rsaPrivKey := tempPrivKey.(*rsa.PrivateKey) 53 | rsaPrivPEM := pemEncode(rsaPrivKey) 54 | 55 | zBytes := sha256.Sum256([]byte(keyAuth)) 56 | z := hex.EncodeToString(zBytes[:sha256.Size]) 57 | domain := fmt.Sprintf("%s.%s.acme.invalid", z[:32], z[32:]) 58 | tempCertPEM, err := generatePemCert(rsaPrivKey, domain) 59 | if err != nil { 60 | return tls.Certificate{}, "", err 61 | } 62 | 63 | certificate, err := tls.X509KeyPair(tempCertPEM, rsaPrivPEM) 64 | if err != nil { 65 | return tls.Certificate{}, "", err 66 | } 67 | 68 | return certificate, domain, nil 69 | } 70 | 71 | // TLSSNI01ChallengeCert returns a certificate for the `tls-sni-01` challenge 72 | func TLSSNI01ChallengeCert(keyAuth string) (tls.Certificate, error) { 73 | cert, _, err := TLSSNI01ChallengeCertDomain(keyAuth) 74 | return cert, err 75 | } 76 | -------------------------------------------------------------------------------- /golang/vendor/github.com/satori/go.uuid/sql.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013-2018 by Maxim Bublis 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining 4 | // a copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to 8 | // permit persons to whom the Software is furnished to do so, subject to 9 | // the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be 12 | // included in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package uuid 23 | 24 | import ( 25 | "database/sql/driver" 26 | "fmt" 27 | ) 28 | 29 | // Value implements the driver.Valuer interface. 30 | func (u UUID) Value() (driver.Value, error) { 31 | return u.String(), nil 32 | } 33 | 34 | // Scan implements the sql.Scanner interface. 35 | // A 16-byte slice is handled by UnmarshalBinary, while 36 | // a longer byte slice or a string is handled by UnmarshalText. 37 | func (u *UUID) Scan(src interface{}) error { 38 | switch src := src.(type) { 39 | case []byte: 40 | if len(src) == Size { 41 | return u.UnmarshalBinary(src) 42 | } 43 | return u.UnmarshalText(src) 44 | 45 | case string: 46 | return u.UnmarshalText([]byte(src)) 47 | } 48 | 49 | return fmt.Errorf("uuid: cannot convert %T to UUID", src) 50 | } 51 | 52 | // NullUUID can be used with the standard sql package to represent a 53 | // UUID value that can be NULL in the database 54 | type NullUUID struct { 55 | UUID UUID 56 | Valid bool 57 | } 58 | 59 | // Value implements the driver.Valuer interface. 60 | func (u NullUUID) Value() (driver.Value, error) { 61 | if !u.Valid { 62 | return nil, nil 63 | } 64 | // Delegate to UUID Value function 65 | return u.UUID.Value() 66 | } 67 | 68 | // Scan implements the sql.Scanner interface. 69 | func (u *NullUUID) Scan(src interface{}) error { 70 | if src == nil { 71 | u.UUID, u.Valid = Nil, false 72 | return nil 73 | } 74 | 75 | // Delegate to UUID Scan function 76 | u.Valid = true 77 | return u.UUID.Scan(src) 78 | } 79 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/flv/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package flv_test 23 | 24 | import ( 25 | "github.com/ossrs/go-oryx-lib/flv" 26 | "io" 27 | ) 28 | 29 | func ExampleDemuxer() { 30 | // To open a flv file, or http flv stream. 31 | var r io.Reader 32 | 33 | var err error 34 | var f flv.Demuxer 35 | if f, err = flv.NewDemuxer(r); err != nil { 36 | return 37 | } 38 | defer f.Close() 39 | 40 | var version uint8 41 | var hasVideo, hasAudio bool 42 | if version, hasVideo, hasAudio, err = f.ReadHeader(); err != nil { 43 | return 44 | } 45 | 46 | // Optional, user can check the header. 47 | _ = version 48 | _ = hasAudio 49 | _ = hasVideo 50 | 51 | var tagType flv.TagType 52 | var tagSize, timestamp uint32 53 | if tagType, tagSize, timestamp, err = f.ReadTagHeader(); err != nil { 54 | return 55 | } 56 | 57 | var tag []byte 58 | if tag, err = f.ReadTag(tagSize); err != nil { 59 | return 60 | } 61 | 62 | // Using the FLV tag type, dts and body. 63 | // Refer to @doc video_file_format_spec_v10.pdf, @page 9, @section FLV tags 64 | _ = tagType 65 | _ = timestamp 66 | _ = tag 67 | } 68 | 69 | func ExampleMuxer() { 70 | // To open a flv file or http post stream. 71 | var w io.Writer 72 | 73 | var err error 74 | var f flv.Muxer 75 | if f, err = flv.NewMuxer(w); err != nil { 76 | return 77 | } 78 | defer f.Close() 79 | 80 | if err = f.WriteHeader(true, true); err != nil { 81 | return 82 | } 83 | 84 | var tagType flv.TagType 85 | var timestamp uint32 86 | var tag []byte 87 | // Get a FLV tag to write to muxer. 88 | if err = f.WriteTag(tagType, timestamp, tag); err != nil { 89 | return 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/client_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket 7 | 8 | import ( 9 | "net/url" 10 | "reflect" 11 | "testing" 12 | ) 13 | 14 | var parseURLTests = []struct { 15 | s string 16 | u *url.URL 17 | rui string 18 | }{ 19 | {"ws://example.com/", &url.URL{Scheme: "ws", Host: "example.com", Opaque: "/"}, "/"}, 20 | {"ws://example.com", &url.URL{Scheme: "ws", Host: "example.com", Opaque: "/"}, "/"}, 21 | {"ws://example.com:7777/", &url.URL{Scheme: "ws", Host: "example.com:7777", Opaque: "/"}, "/"}, 22 | {"wss://example.com/", &url.URL{Scheme: "wss", Host: "example.com", Opaque: "/"}, "/"}, 23 | {"wss://example.com/a/b", &url.URL{Scheme: "wss", Host: "example.com", Opaque: "/a/b"}, "/a/b"}, 24 | {"ss://example.com/a/b", nil, ""}, 25 | {"ws://webmaster@example.com/", nil, ""}, 26 | {"wss://example.com/a/b?x=y", &url.URL{Scheme: "wss", Host: "example.com", Opaque: "/a/b", RawQuery: "x=y"}, "/a/b?x=y"}, 27 | {"wss://example.com?x=y", &url.URL{Scheme: "wss", Host: "example.com", Opaque: "/", RawQuery: "x=y"}, "/?x=y"}, 28 | } 29 | 30 | func TestParseURL(t *testing.T) { 31 | for _, tt := range parseURLTests { 32 | u, err := parseURL(tt.s) 33 | if tt.u != nil && err != nil { 34 | t.Errorf("parseURL(%q) returned error %v", tt.s, err) 35 | continue 36 | } 37 | if tt.u == nil { 38 | if err == nil { 39 | t.Errorf("parseURL(%q) did not return error", tt.s) 40 | } 41 | continue 42 | } 43 | if !reflect.DeepEqual(u, tt.u) { 44 | t.Errorf("parseURL(%q) = %v, want %v", tt.s, u, tt.u) 45 | continue 46 | } 47 | if u.RequestURI() != tt.rui { 48 | t.Errorf("parseURL(%q).RequestURI() = %v, want %v", tt.s, u.RequestURI(), tt.rui) 49 | } 50 | } 51 | } 52 | 53 | var hostPortNoPortTests = []struct { 54 | u *url.URL 55 | hostPort, hostNoPort string 56 | }{ 57 | {&url.URL{Scheme: "ws", Host: "example.com"}, "example.com:80", "example.com"}, 58 | {&url.URL{Scheme: "wss", Host: "example.com"}, "example.com:443", "example.com"}, 59 | {&url.URL{Scheme: "ws", Host: "example.com:7777"}, "example.com:7777", "example.com"}, 60 | {&url.URL{Scheme: "wss", Host: "example.com:7777"}, "example.com:7777", "example.com"}, 61 | } 62 | 63 | func TestHostPortNoPort(t *testing.T) { 64 | for _, tt := range hostPortNoPortTests { 65 | hostPort, hostNoPort := hostPortNoPort(tt.u) 66 | if hostPort != tt.hostPort { 67 | t.Errorf("hostPortNoPort(%v) returned hostPort %q, want %q", tt.u, hostPort, tt.hostPort) 68 | } 69 | if hostNoPort != tt.hostNoPort { 70 | t.Errorf("hostPortNoPort(%v) returned hostNoPort %q, want %q", tt.u, hostNoPort, tt.hostNoPort) 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/jws.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import ( 6 | "bytes" 7 | "crypto" 8 | "crypto/ecdsa" 9 | "crypto/elliptic" 10 | "crypto/rsa" 11 | "fmt" 12 | "net/http" 13 | 14 | "github.com/ossrs/go-oryx-lib/https/jose" 15 | ) 16 | 17 | type jws struct { 18 | directoryURL string 19 | privKey crypto.PrivateKey 20 | nonces []string 21 | } 22 | 23 | func keyAsJWK(key interface{}) *jose.JsonWebKey { 24 | switch k := key.(type) { 25 | case *ecdsa.PublicKey: 26 | return &jose.JsonWebKey{Key: k, Algorithm: "EC"} 27 | case *rsa.PublicKey: 28 | return &jose.JsonWebKey{Key: k, Algorithm: "RSA"} 29 | 30 | default: 31 | return nil 32 | } 33 | } 34 | 35 | // Posts a JWS signed message to the specified URL 36 | func (j *jws) post(url string, content []byte) (*http.Response, error) { 37 | signedContent, err := j.signContent(content) 38 | if err != nil { 39 | return nil, err 40 | } 41 | 42 | resp, err := httpPost(url, "application/jose+json", bytes.NewBuffer([]byte(signedContent.FullSerialize()))) 43 | if err != nil { 44 | return nil, err 45 | } 46 | 47 | j.getNonceFromResponse(resp) 48 | 49 | return resp, err 50 | } 51 | 52 | func (j *jws) signContent(content []byte) (*jose.JsonWebSignature, error) { 53 | 54 | var alg jose.SignatureAlgorithm 55 | switch k := j.privKey.(type) { 56 | case *rsa.PrivateKey: 57 | alg = jose.RS256 58 | case *ecdsa.PrivateKey: 59 | if k.Curve == elliptic.P256() { 60 | alg = jose.ES256 61 | } else if k.Curve == elliptic.P384() { 62 | alg = jose.ES384 63 | } 64 | } 65 | 66 | signer, err := jose.NewSigner(alg, j.privKey) 67 | if err != nil { 68 | return nil, err 69 | } 70 | signer.SetNonceSource(j) 71 | 72 | signed, err := signer.Sign(content) 73 | if err != nil { 74 | return nil, err 75 | } 76 | return signed, nil 77 | } 78 | 79 | func (j *jws) getNonceFromResponse(resp *http.Response) error { 80 | nonce := resp.Header.Get("Replay-Nonce") 81 | if nonce == "" { 82 | return fmt.Errorf("Server did not respond with a proper nonce header.") 83 | } 84 | 85 | j.nonces = append(j.nonces, nonce) 86 | return nil 87 | } 88 | 89 | func (j *jws) getNonce() error { 90 | resp, err := httpHead(j.directoryURL) 91 | if err != nil { 92 | return err 93 | } 94 | 95 | return j.getNonceFromResponse(resp) 96 | } 97 | 98 | func (j *jws) Nonce() (string, error) { 99 | nonce := "" 100 | if len(j.nonces) == 0 { 101 | err := j.getNonce() 102 | if err != nil { 103 | return nonce, err 104 | } 105 | } 106 | 107 | nonce, j.nonces = j.nonces[len(j.nonces)-1], j.nonces[:len(j.nonces)-1] 108 | return nonce, nil 109 | } 110 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/gmoryx/sys_http.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The gmoryx(gomobile oryx APIs) http package exported for mobile. 23 | package gmoryx 24 | 25 | import ( 26 | "fmt" 27 | "net" 28 | "net/http" 29 | ) 30 | 31 | type HttpResponseWriter interface { 32 | Write([]byte) (int, error) 33 | } 34 | 35 | type HttpRequest struct { 36 | r *http.Request 37 | } 38 | 39 | type HttpHandler interface { 40 | ServeHTTP(HttpResponseWriter, *HttpRequest) 41 | } 42 | 43 | func HttpHandle(pattern string, handler HttpHandler) { 44 | http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) { 45 | handler.ServeHTTP(w, &HttpRequest{r: r}) 46 | }) 47 | } 48 | 49 | var httpError error 50 | var httpListener net.Listener 51 | 52 | func HttpListenAndServe(addr string, handler HttpHandler) (err error) { 53 | var h http.Handler 54 | if handler != nil { 55 | h = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 56 | handler.ServeHTTP(w, &HttpRequest{r: r}) 57 | }) 58 | } 59 | 60 | srv := &http.Server{Addr: addr, Handler: h} 61 | 62 | if addr = srv.Addr; addr == "" { 63 | addr = ":http" 64 | } 65 | 66 | httpListener, err = net.Listen("tcp", addr) 67 | if err != nil { 68 | return 69 | } 70 | 71 | go func() { 72 | defer func() { 73 | if r := recover(); r != nil { 74 | httpError = fmt.Errorf("Recover from %v", r) 75 | } 76 | }() 77 | srv.Serve(httpListener.(*net.TCPListener)) 78 | }() 79 | 80 | return 81 | } 82 | 83 | func HttpShutdown() (err error) { 84 | if httpListener != nil { 85 | err = httpListener.Close() 86 | httpListener = nil 87 | } 88 | 89 | if err != nil { 90 | return 91 | } 92 | 93 | return httpError 94 | } 95 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/acme/http_challenge_server.go: -------------------------------------------------------------------------------- 1 | // fork from https://github.com/rsc/letsencrypt/tree/master/vendor/github.com/xenolf/lego/acme 2 | // fork from https://github.com/xenolf/lego/tree/master/acme 3 | package acme 4 | 5 | import ( 6 | "fmt" 7 | "net" 8 | "net/http" 9 | "strings" 10 | ) 11 | 12 | // HTTPProviderServer implements ChallengeProvider for `http-01` challenge 13 | // It may be instantiated without using the NewHTTPProviderServer function if 14 | // you want only to use the default values. 15 | type HTTPProviderServer struct { 16 | iface string 17 | port string 18 | done chan bool 19 | listener net.Listener 20 | } 21 | 22 | // NewHTTPProviderServer creates a new HTTPProviderServer on the selected interface and port. 23 | // Setting iface and / or port to an empty string will make the server fall back to 24 | // the "any" interface and port 80 respectively. 25 | func NewHTTPProviderServer(iface, port string) *HTTPProviderServer { 26 | return &HTTPProviderServer{iface: iface, port: port} 27 | } 28 | 29 | // Present starts a web server and makes the token available at `HTTP01ChallengePath(token)` for web requests. 30 | func (s *HTTPProviderServer) Present(domain, token, keyAuth string) error { 31 | if s.port == "" { 32 | s.port = "80" 33 | } 34 | 35 | var err error 36 | s.listener, err = net.Listen("tcp", net.JoinHostPort(s.iface, s.port)) 37 | if err != nil { 38 | return fmt.Errorf("Could not start HTTP server for challenge -> %v", err) 39 | } 40 | 41 | s.done = make(chan bool) 42 | go s.serve(domain, token, keyAuth) 43 | return nil 44 | } 45 | 46 | // CleanUp closes the HTTP server and removes the token from `HTTP01ChallengePath(token)` 47 | func (s *HTTPProviderServer) CleanUp(domain, token, keyAuth string) error { 48 | if s.listener == nil { 49 | return nil 50 | } 51 | s.listener.Close() 52 | <-s.done 53 | return nil 54 | } 55 | 56 | func (s *HTTPProviderServer) serve(domain, token, keyAuth string) { 57 | path := HTTP01ChallengePath(token) 58 | 59 | // The handler validates the HOST header and request type. 60 | // For validation it then writes the token the server returned with the challenge 61 | mux := http.NewServeMux() 62 | mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) { 63 | if strings.HasPrefix(r.Host, domain) && r.Method == "GET" { 64 | w.Header().Add("Content-Type", "text/plain") 65 | w.Write([]byte(keyAuth)) 66 | logf("[INFO][%s] Served key authentication", domain) 67 | } else { 68 | logf("[INFO] Received request for domain %s with method %s", r.Host, r.Method) 69 | w.Write([]byte("TEST")) 70 | } 71 | }) 72 | 73 | httpServer := &http.Server{ 74 | Handler: mux, 75 | } 76 | // Once httpServer is shut down we don't want any lingering 77 | // connections, so disable KeepAlives. 78 | httpServer.SetKeepAlivesEnabled(false) 79 | httpServer.Serve(s.listener) 80 | s.done <- true 81 | } 82 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/json_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket 7 | 8 | import ( 9 | "bytes" 10 | "encoding/json" 11 | "io" 12 | "reflect" 13 | "testing" 14 | ) 15 | 16 | func TestJSON(t *testing.T) { 17 | var buf bytes.Buffer 18 | c := fakeNetConn{&buf, &buf} 19 | wc := newConn(c, true, 1024, 1024) 20 | rc := newConn(c, false, 1024, 1024) 21 | 22 | var actual, expect struct { 23 | A int 24 | B string 25 | } 26 | expect.A = 1 27 | expect.B = "hello" 28 | 29 | if err := wc.WriteJSON(&expect); err != nil { 30 | t.Fatal("write", err) 31 | } 32 | 33 | if err := rc.ReadJSON(&actual); err != nil { 34 | t.Fatal("read", err) 35 | } 36 | 37 | if !reflect.DeepEqual(&actual, &expect) { 38 | t.Fatal("equal", actual, expect) 39 | } 40 | } 41 | 42 | func TestPartialJSONRead(t *testing.T) { 43 | var buf bytes.Buffer 44 | c := fakeNetConn{&buf, &buf} 45 | wc := newConn(c, true, 1024, 1024) 46 | rc := newConn(c, false, 1024, 1024) 47 | 48 | var v struct { 49 | A int 50 | B string 51 | } 52 | v.A = 1 53 | v.B = "hello" 54 | 55 | messageCount := 0 56 | 57 | // Partial JSON values. 58 | 59 | data, err := json.Marshal(v) 60 | if err != nil { 61 | t.Fatal(err) 62 | } 63 | for i := len(data) - 1; i >= 0; i-- { 64 | if err := wc.WriteMessage(TextMessage, data[:i]); err != nil { 65 | t.Fatal(err) 66 | } 67 | messageCount++ 68 | } 69 | 70 | // Whitespace. 71 | 72 | if err := wc.WriteMessage(TextMessage, []byte(" ")); err != nil { 73 | t.Fatal(err) 74 | } 75 | messageCount++ 76 | 77 | // Close. 78 | 79 | if err := wc.WriteMessage(CloseMessage, FormatCloseMessage(CloseNormalClosure, "")); err != nil { 80 | t.Fatal(err) 81 | } 82 | 83 | for i := 0; i < messageCount; i++ { 84 | err := rc.ReadJSON(&v) 85 | if err != io.ErrUnexpectedEOF { 86 | t.Error("read", i, err) 87 | } 88 | } 89 | 90 | err = rc.ReadJSON(&v) 91 | if _, ok := err.(*CloseError); !ok { 92 | t.Error("final", err) 93 | } 94 | } 95 | 96 | func TestDeprecatedJSON(t *testing.T) { 97 | var buf bytes.Buffer 98 | c := fakeNetConn{&buf, &buf} 99 | wc := newConn(c, true, 1024, 1024) 100 | rc := newConn(c, false, 1024, 1024) 101 | 102 | var actual, expect struct { 103 | A int 104 | B string 105 | } 106 | expect.A = 1 107 | expect.B = "hello" 108 | 109 | if err := WriteJSON(wc, &expect); err != nil { 110 | t.Fatal("write", err) 111 | } 112 | 113 | if err := ReadJSON(rc, &actual); err != nil { 114 | t.Fatal("read", err) 115 | } 116 | 117 | if !reflect.DeepEqual(&actual, &expect) { 118 | t.Fatal("equal", actual, expect) 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/util_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket 7 | 8 | import ( 9 | "net/http" 10 | "reflect" 11 | "testing" 12 | ) 13 | 14 | var tokenListContainsValueTests = []struct { 15 | value string 16 | ok bool 17 | }{ 18 | {"WebSocket", true}, 19 | {"WEBSOCKET", true}, 20 | {"websocket", true}, 21 | {"websockets", false}, 22 | {"x websocket", false}, 23 | {"websocket x", false}, 24 | {"other,websocket,more", true}, 25 | {"other, websocket, more", true}, 26 | } 27 | 28 | func TestTokenListContainsValue(t *testing.T) { 29 | for _, tt := range tokenListContainsValueTests { 30 | h := http.Header{"Upgrade": {tt.value}} 31 | ok := tokenListContainsValue(h, "Upgrade", "websocket") 32 | if ok != tt.ok { 33 | t.Errorf("tokenListContainsValue(h, n, %q) = %v, want %v", tt.value, ok, tt.ok) 34 | } 35 | } 36 | } 37 | 38 | var parseExtensionTests = []struct { 39 | value string 40 | extensions []map[string]string 41 | }{ 42 | {`foo`, []map[string]string{map[string]string{"": "foo"}}}, 43 | {`foo, bar; baz=2`, []map[string]string{ 44 | map[string]string{"": "foo"}, 45 | map[string]string{"": "bar", "baz": "2"}}}, 46 | {`foo; bar="b,a;z"`, []map[string]string{ 47 | map[string]string{"": "foo", "bar": "b,a;z"}}}, 48 | {`foo , bar; baz = 2`, []map[string]string{ 49 | map[string]string{"": "foo"}, 50 | map[string]string{"": "bar", "baz": "2"}}}, 51 | {`foo, bar; baz=2 junk`, []map[string]string{ 52 | map[string]string{"": "foo"}}}, 53 | {`foo junk, bar; baz=2 junk`, nil}, 54 | {`mux; max-channels=4; flow-control, deflate-stream`, []map[string]string{ 55 | map[string]string{"": "mux", "max-channels": "4", "flow-control": ""}, 56 | map[string]string{"": "deflate-stream"}}}, 57 | {`permessage-foo; x="10"`, []map[string]string{ 58 | map[string]string{"": "permessage-foo", "x": "10"}}}, 59 | {`permessage-foo; use_y, permessage-foo`, []map[string]string{ 60 | map[string]string{"": "permessage-foo", "use_y": ""}, 61 | map[string]string{"": "permessage-foo"}}}, 62 | {`permessage-deflate; client_max_window_bits; server_max_window_bits=10 , permessage-deflate; client_max_window_bits`, []map[string]string{ 63 | map[string]string{"": "permessage-deflate", "client_max_window_bits": "", "server_max_window_bits": "10"}, 64 | map[string]string{"": "permessage-deflate", "client_max_window_bits": ""}}}, 65 | } 66 | 67 | func TestParseExtensions(t *testing.T) { 68 | for _, tt := range parseExtensionTests { 69 | h := http.Header{http.CanonicalHeaderKey("Sec-WebSocket-Extensions"): {tt.value}} 70 | extensions := parseExtensions(h) 71 | if !reflect.DeepEqual(extensions, tt.extensions) { 72 | t.Errorf("parseExtensions(%q)\n = %v,\nwant %v", tt.value, extensions, tt.extensions) 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/http/api.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The oryx http package, the response parse service. 23 | package http 24 | 25 | import ( 26 | "encoding/json" 27 | "fmt" 28 | "io/ioutil" 29 | "net/http" 30 | ) 31 | 32 | // Read http api by HTTP GET and parse the code/data. 33 | func ApiRequest(url string) (code int, body []byte, err error) { 34 | if body, err = apiGet(url); err != nil { 35 | return 36 | } 37 | 38 | if code, _, err = apiParse(url, body); err != nil { 39 | return 40 | } 41 | 42 | return 43 | } 44 | 45 | // Read http api by HTTP GET. 46 | func apiGet(url string) (body []byte, err error) { 47 | var resp *http.Response 48 | if resp, err = http.Get(url); err != nil { 49 | err = fmt.Errorf("api get failed, url=%v, err is %v", url, err) 50 | return 51 | } 52 | defer resp.Body.Close() 53 | 54 | if body, err = ioutil.ReadAll(resp.Body); err != nil { 55 | err = fmt.Errorf("api read failed, url=%v, err is %v", url, err) 56 | return 57 | } 58 | 59 | return 60 | } 61 | 62 | // Parse the standard response {code:int,data:object}. 63 | func apiParse(url string, body []byte) (code int, data interface{}, err error) { 64 | obj := make(map[string]interface{}) 65 | if err = json.Unmarshal(body, &obj); err != nil { 66 | err = fmt.Errorf("api parse failed, url=%v, body=%v, err is %v", url, string(body), err) 67 | return 68 | } 69 | 70 | if value, ok := obj["code"]; !ok { 71 | err = fmt.Errorf("api no code, url=%v, body=%v", url, string(body)) 72 | return 73 | } else if value, ok := value.(float64); !ok { 74 | err = fmt.Errorf("api code not number, code=%v, url=%v, body=%v", value, url, string(body)) 75 | return 76 | } else { 77 | code = int(value) 78 | } 79 | 80 | data, _ = obj["data"] 81 | if code != 0 { 82 | err = fmt.Errorf("api error, code=%v, url=%v, body=%v, data=%v", code, url, string(body), data) 83 | return 84 | } 85 | 86 | return 87 | } 88 | -------------------------------------------------------------------------------- /nodejs/index.js: -------------------------------------------------------------------------------- 1 | var config = require('./config'); 2 | console.log('Server listen=' + config.listen + ', appid=' + config.appId 3 | + ', appkey=' + config.appKey + ', gslb=' + config.gslb); 4 | 5 | const http = require('http'); 6 | 7 | const url = require('url'); 8 | const query = require('querystring'); 9 | const uuidv4 = require('uuid/v4'); 10 | 11 | const sha256 = require('sha256/lib/sha256'); 12 | 13 | function CreateUserID(channelId, user) { 14 | var uid = sha256(channelId + '/' + user); 15 | return uid.substr(0, 16); 16 | } 17 | 18 | function CreateToken( 19 | appId, appKey, channelId, userId, nonce, timestamp 20 | ) { 21 | var token = sha256(appId + appKey + channelId + userId + nonce + timestamp); 22 | return token; 23 | } 24 | 25 | const server = http.createServer((req, res) => { 26 | if (req.headers['Origin'] != '') { 27 | res.setHeader("Access-Control-Allow-Origin", "*"); 28 | res.setHeader("Access-Control-Allow-Methods", "GET,POST,HEAD,PUT,DELETE,OPTIONS"); 29 | res.setHeader("Access-Control-Expose-Headers", "Server,Range,Content-Length,Content-Range"); 30 | res.setHeader("Access-Control-Allow-Headers", "Origin,Range,Accept-Encoding,Referer,Cache-Control,X-Proxy-Authorization,X-Requested-With,Content-Type"); 31 | } 32 | 33 | if (req.method == "OPTIONS") { 34 | res.end(); 35 | return; 36 | } 37 | 38 | var q = query.parse(url.parse(req.url).query); 39 | var channelId = q['room']; 40 | var user = q['user']; 41 | console.log('Request channelId=' + channelId + ', user=' + user + ', appid=' + config.appId); 42 | 43 | if (channelId == "" || user == "") { 44 | res.writeHead(500); 45 | res.end(JSON.stringify("invalid parameter")); 46 | } 47 | 48 | var userId = CreateUserID(channelId, user); 49 | 50 | // Warning: nonce support the AppKey generated token. 51 | // the Nonce should be prefix with 'AK-' otherwise the joining verification will failed. 52 | // eg. nonce: "AK-0464002093ce3dd010cb05356c8b1d0f". 53 | var nonce = 'AK-' + uuidv4(); 54 | 55 | // Warning: timestamp is the token expiration time. 56 | // User can custom defined the expire time of token. 57 | // eg, Expires in two days. timestamp: 1559890860. 58 | var timestamp = parseInt(new Date().getTime()/1000 + 48*60*60); 59 | 60 | var token = CreateToken(config.appId, config.appKey, channelId, userId, nonce, timestamp); 61 | 62 | var username = userId + '?appid=' + config.appId 63 | + '&channel=' + channelId + '&nonce=' + nonce 64 | + '×tamp=' + timestamp; 65 | 66 | console.log('Login: appID=' + config.appId + ', appKey=' + config.appKey + ', channelID=' 67 | + channelId + ', userID=' + userId + ', nonce=' + nonce + ', timestamp=' 68 | + timestamp + ', user=' + user + ', userName=' + username + ', token=' + token) 69 | 70 | res.setHeader("Content-Type", "application/json"); 71 | res.end(JSON.stringify({ 72 | code: 0, 73 | data: { 74 | appid: config.appId, 75 | userid: userId, 76 | gslb: [config.gslb], 77 | token: token, 78 | nonce: nonce, 79 | timestamp: timestamp, 80 | turn: { 81 | username: username, 82 | password: token 83 | } 84 | } 85 | })); 86 | }); 87 | 88 | server.listen(config.listen); 89 | 90 | 91 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/logger/go17.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // +build go1.7 23 | 24 | package logger 25 | 26 | import ( 27 | "context" 28 | "fmt" 29 | "os" 30 | ) 31 | 32 | func (v *loggerPlus) Println(ctx Context, a ...interface{}) { 33 | args := v.contextFormat(ctx, a...) 34 | v.doPrintln(args...) 35 | } 36 | 37 | func (v *loggerPlus) Printf(ctx Context, format string, a ...interface{}) { 38 | format, args := v.contextFormatf(ctx, format, a...) 39 | v.doPrintf(format, args...) 40 | } 41 | 42 | func (v *loggerPlus) contextFormat(ctx Context, a ...interface{}) []interface{} { 43 | if ctx, ok := ctx.(context.Context); ok { 44 | if cid, ok := ctx.Value(cidKey).(int); ok { 45 | return append([]interface{}{fmt.Sprintf("[%v][%v]", os.Getpid(), cid)}, a...) 46 | } 47 | } else { 48 | return v.format(ctx, a...) 49 | } 50 | return a 51 | } 52 | 53 | func (v *loggerPlus) contextFormatf(ctx Context, format string, a ...interface{}) (string, []interface{}) { 54 | if ctx, ok := ctx.(context.Context); ok { 55 | if cid, ok := ctx.Value(cidKey).(int); ok { 56 | return "[%v][%v] " + format, append([]interface{}{os.Getpid(), cid}, a...) 57 | } 58 | } else { 59 | return v.formatf(ctx, format, a...) 60 | } 61 | return format, a 62 | } 63 | 64 | // User should use context with value to pass the cid. 65 | type key string 66 | 67 | var cidKey key = "cid.logger.ossrs.org" 68 | 69 | var gCid int = 999 70 | 71 | // Create context with value. 72 | func WithContext(ctx context.Context) context.Context { 73 | gCid += 1 74 | return context.WithValue(ctx, cidKey, gCid) 75 | } 76 | 77 | // Create context with value from parent, copy the cid from source context. 78 | // @remark Create new cid if source has no cid represent. 79 | func AliasContext(parent context.Context, source context.Context) context.Context { 80 | if source != nil { 81 | if cid, ok := source.Value(cidKey).(int); ok { 82 | return context.WithValue(parent, cidKey, cid) 83 | } 84 | } 85 | return WithContext(parent) 86 | } 87 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/kxps/krps.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The krps is about the request or message rate. 23 | package kxps 24 | 25 | import ( 26 | ol "github.com/ossrs/go-oryx-lib/logger" 27 | "io" 28 | ) 29 | 30 | // The source to stat the requests. 31 | type KrpsSource interface { 32 | // Get total number of requests. 33 | NbRequests() uint64 34 | } 35 | 36 | // The object to calc the krps. 37 | type Krps interface { 38 | // Start the krps sample goroutine. 39 | Start() (err error) 40 | 41 | // Get the rps in last 10s. 42 | Rps10s() float64 43 | // Get the rps in last 30s. 44 | Rps30s() float64 45 | // Get the rps in last 300s. 46 | Rps300s() float64 47 | // Get the rps in average 48 | Average() float64 49 | 50 | // When closed, this krps should never use again. 51 | io.Closer 52 | } 53 | 54 | // The implementation object. 55 | type krps struct { 56 | source KrpsSource 57 | imp *kxps 58 | } 59 | 60 | func NewKrps(ctx ol.Context, s KrpsSource) Krps { 61 | v := &krps{ 62 | source: s, 63 | } 64 | v.imp = newKxps(ctx, v) 65 | return v 66 | } 67 | 68 | func (v *krps) Count() uint64 { 69 | return v.source.NbRequests() 70 | } 71 | 72 | func (v *krps) Close() (err error) { 73 | return v.imp.Close() 74 | } 75 | 76 | func (v *krps) Rps10s() float64 { 77 | if !v.imp.started { 78 | panic("should start krps first.") 79 | } 80 | return v.imp.Xps10s() 81 | } 82 | 83 | func (v *krps) Rps30s() float64 { 84 | if !v.imp.started { 85 | panic("should start krps first.") 86 | } 87 | return v.imp.Xps30s() 88 | } 89 | 90 | func (v *krps) Rps300s() float64 { 91 | if !v.imp.started { 92 | panic("should start krps first.") 93 | } 94 | return v.imp.Xps300s() 95 | } 96 | 97 | func (v *krps) Average() float64 { 98 | if !v.imp.started { 99 | panic("should start krps first.") 100 | } 101 | return v.imp.Average() 102 | } 103 | 104 | func (v *krps) Start() (err error) { 105 | return v.imp.Start() 106 | } 107 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/jose/cipher/key_wrap.go: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2014 Square Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // from gopkg.in/square/go-jose.v1/cipher 18 | package josecipher 19 | 20 | import ( 21 | "crypto/cipher" 22 | "crypto/subtle" 23 | "encoding/binary" 24 | "errors" 25 | ) 26 | 27 | var defaultIV = []byte{0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6} 28 | 29 | // KeyWrap implements NIST key wrapping; it wraps a content encryption key (cek) with the given block cipher. 30 | func KeyWrap(block cipher.Block, cek []byte) ([]byte, error) { 31 | if len(cek)%8 != 0 { 32 | return nil, errors.New("square/go-jose: key wrap input must be 8 byte blocks") 33 | } 34 | 35 | n := len(cek) / 8 36 | r := make([][]byte, n) 37 | 38 | for i := range r { 39 | r[i] = make([]byte, 8) 40 | copy(r[i], cek[i*8:]) 41 | } 42 | 43 | buffer := make([]byte, 16) 44 | tBytes := make([]byte, 8) 45 | copy(buffer, defaultIV) 46 | 47 | for t := 0; t < 6*n; t++ { 48 | copy(buffer[8:], r[t%n]) 49 | 50 | block.Encrypt(buffer, buffer) 51 | 52 | binary.BigEndian.PutUint64(tBytes, uint64(t+1)) 53 | 54 | for i := 0; i < 8; i++ { 55 | buffer[i] = buffer[i] ^ tBytes[i] 56 | } 57 | copy(r[t%n], buffer[8:]) 58 | } 59 | 60 | out := make([]byte, (n+1)*8) 61 | copy(out, buffer[:8]) 62 | for i := range r { 63 | copy(out[(i+1)*8:], r[i]) 64 | } 65 | 66 | return out, nil 67 | } 68 | 69 | // KeyUnwrap implements NIST key unwrapping; it unwraps a content encryption key (cek) with the given block cipher. 70 | func KeyUnwrap(block cipher.Block, ciphertext []byte) ([]byte, error) { 71 | if len(ciphertext)%8 != 0 { 72 | return nil, errors.New("square/go-jose: key wrap input must be 8 byte blocks") 73 | } 74 | 75 | n := (len(ciphertext) / 8) - 1 76 | r := make([][]byte, n) 77 | 78 | for i := range r { 79 | r[i] = make([]byte, 8) 80 | copy(r[i], ciphertext[(i+1)*8:]) 81 | } 82 | 83 | buffer := make([]byte, 16) 84 | tBytes := make([]byte, 8) 85 | copy(buffer[:8], ciphertext[:8]) 86 | 87 | for t := 6*n - 1; t >= 0; t-- { 88 | binary.BigEndian.PutUint64(tBytes, uint64(t+1)) 89 | 90 | for i := 0; i < 8; i++ { 91 | buffer[i] = buffer[i] ^ tBytes[i] 92 | } 93 | copy(buffer[8:], r[t%n]) 94 | 95 | block.Decrypt(buffer, buffer) 96 | 97 | copy(r[t%n], buffer[8:]) 98 | } 99 | 100 | if subtle.ConstantTimeCompare(buffer[:8], defaultIV) == 0 { 101 | return nil, errors.New("square/go-jose: failed to unwrap key") 102 | } 103 | 104 | out := make([]byte, n*8) 105 | for i := range r { 106 | copy(out[i*8:], r[i]) 107 | } 108 | 109 | return out, nil 110 | } 111 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/https/net/context/go17.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.7 6 | 7 | // fork from golang.org/x/net/context 8 | // from https://github.com/golang/net 9 | package context 10 | 11 | import ( 12 | "context" // standard library's context, as of Go 1.7 13 | "time" 14 | ) 15 | 16 | var ( 17 | todo = context.TODO() 18 | background = context.Background() 19 | ) 20 | 21 | // Canceled is the error returned by Context.Err when the context is canceled. 22 | var Canceled = context.Canceled 23 | 24 | // DeadlineExceeded is the error returned by Context.Err when the context's 25 | // deadline passes. 26 | var DeadlineExceeded = context.DeadlineExceeded 27 | 28 | // WithCancel returns a copy of parent with a new Done channel. The returned 29 | // context's Done channel is closed when the returned cancel function is called 30 | // or when the parent context's Done channel is closed, whichever happens first. 31 | // 32 | // Canceling this context releases resources associated with it, so code should 33 | // call cancel as soon as the operations running in this Context complete. 34 | func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { 35 | ctx, f := context.WithCancel(parent) 36 | return ctx, CancelFunc(f) 37 | } 38 | 39 | // WithDeadline returns a copy of the parent context with the deadline adjusted 40 | // to be no later than d. If the parent's deadline is already earlier than d, 41 | // WithDeadline(parent, d) is semantically equivalent to parent. The returned 42 | // context's Done channel is closed when the deadline expires, when the returned 43 | // cancel function is called, or when the parent context's Done channel is 44 | // closed, whichever happens first. 45 | // 46 | // Canceling this context releases resources associated with it, so code should 47 | // call cancel as soon as the operations running in this Context complete. 48 | func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { 49 | ctx, f := context.WithDeadline(parent, deadline) 50 | return ctx, CancelFunc(f) 51 | } 52 | 53 | // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). 54 | // 55 | // Canceling this context releases resources associated with it, so code should 56 | // call cancel as soon as the operations running in this Context complete: 57 | // 58 | // func slowOperationWithTimeout(ctx context.Context) (Result, error) { 59 | // ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) 60 | // defer cancel() // releases resources if slowOperation completes before timeout elapses 61 | // return slowOperation(ctx) 62 | // } 63 | func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { 64 | return WithDeadline(parent, time.Now().Add(timeout)) 65 | } 66 | 67 | // WithValue returns a copy of parent in which the value associated with key is 68 | // val. 69 | // 70 | // Use context Values only for request-scoped data that transits processes and 71 | // APIs, not for passing optional parameters to functions. 72 | func WithValue(parent Context, key interface{}, val interface{}) Context { 73 | return context.WithValue(parent, key, val) 74 | } 75 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/kxps/kbps.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The kbps is about the bitrate. 23 | package kxps 24 | 25 | import ( 26 | ol "github.com/ossrs/go-oryx-lib/logger" 27 | "io" 28 | ) 29 | 30 | // The source to stat the bitrate. 31 | type KbpsSource interface { 32 | // Get total number of bytes. 33 | TotalBytes() uint64 34 | } 35 | 36 | // The object to calc the kbps. 37 | type Kbps interface { 38 | // Start the kbps sample goroutine. 39 | Start() (err error) 40 | 41 | // Get the kbps in last 10s. 42 | Kbps10s() float64 43 | // Get the kbps in last 30s. 44 | Kbps30s() float64 45 | // Get the kbps in last 300s. 46 | Kbps300s() float64 47 | // Get the kbps in average 48 | Average() float64 49 | 50 | // When closed, this kbps should never use again. 51 | io.Closer 52 | } 53 | 54 | type kbps struct { 55 | source KbpsSource 56 | imp *kxps 57 | } 58 | 59 | func NewKbps(ctx ol.Context, source KbpsSource) Kbps { 60 | v := &kbps{source: source} 61 | v.imp = newKxps(ctx, v) 62 | return v 63 | } 64 | 65 | func (v *kbps) Count() uint64 { 66 | return v.source.TotalBytes() 67 | } 68 | 69 | func (v *kbps) Close() (err error) { 70 | return v.imp.Close() 71 | } 72 | 73 | func (v *kbps) Kbps10s() float64 { 74 | if !v.imp.started { 75 | panic("should start kbps first.") 76 | } 77 | // Bps to Kbps 78 | return v.imp.Xps10s() * 8 / 1000 79 | } 80 | 81 | func (v *kbps) Kbps30s() float64 { 82 | if !v.imp.started { 83 | panic("should start kbps first.") 84 | } 85 | // Bps to Kbps 86 | return v.imp.Xps30s() * 8 / 1000 87 | } 88 | 89 | func (v *kbps) Kbps300s() float64 { 90 | if !v.imp.started { 91 | panic("should start kbps first.") 92 | } 93 | // Bps to Kbps 94 | return v.imp.Xps300s() * 8 / 1000 95 | } 96 | 97 | func (v *kbps) Average() float64 { 98 | if !v.imp.started { 99 | panic("should start kbps first.") 100 | } 101 | // Bps to Kbps 102 | return v.imp.Average() * 8 / 1000 103 | } 104 | 105 | func (v *kbps) Start() (err error) { 106 | return v.imp.Start() 107 | } 108 | -------------------------------------------------------------------------------- /verify/html/js/3rdparty/angular-resource.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.2.17 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(H,a,A){'use strict';function D(p,g){g=g||{};a.forEach(g,function(a,c){delete g[c]});for(var c in p)!p.hasOwnProperty(c)||"$"===c.charAt(0)&&"$"===c.charAt(1)||(g[c]=p[c]);return g}var v=a.$$minErr("$resource"),C=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;a.module("ngResource",["ng"]).factory("$resource",["$http","$q",function(p,g){function c(a,c){this.template=a;this.defaults=c||{};this.urlParams={}}function t(n,w,l){function r(h,d){var e={};d=x({},w,d);s(d,function(b,d){u(b)&&(b=b());var k;if(b&& 7 | b.charAt&&"@"==b.charAt(0)){k=h;var a=b.substr(1);if(null==a||""===a||"hasOwnProperty"===a||!C.test("."+a))throw v("badmember",a);for(var a=a.split("."),f=0,c=a.length;f"); 42 | sb.append("Welcome to "); 43 | sb.append("GMOryx(GoMobile Oryx)"); 44 | sb.append("!"); 45 | w.write(sb.toString().getBytes()); 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | }); 51 | 52 | try { 53 | Gmoryx.setServer("GMOryx/0.1"); 54 | Gmoryx.httpListenAndServe(":8080", null); 55 | txtMain.setText("Web server: http://" + getHostIP() + ":8080\nPlease access from other machine."); 56 | } catch (Exception e) { 57 | e.printStackTrace(); 58 | } 59 | } 60 | 61 | @Override 62 | protected void onPause() { 63 | super.onPause(); 64 | 65 | try { 66 | Gmoryx.httpShutdown(); 67 | } catch (Exception e) { 68 | e.printStackTrace(); 69 | } 70 | } 71 | 72 | public static String getHostIP() { 73 | String hostIp = null; 74 | try { 75 | Enumeration nis = NetworkInterface.getNetworkInterfaces(); 76 | InetAddress ia = null; 77 | while (nis.hasMoreElements()) { 78 | NetworkInterface ni = (NetworkInterface) nis.nextElement(); 79 | Enumeration ias = ni.getInetAddresses(); 80 | while (ias.hasMoreElements()) { 81 | ia = ias.nextElement(); 82 | if (ia instanceof Inet6Address) { 83 | continue;// skip ipv6 84 | } 85 | String ip = ia.getHostAddress(); 86 | if (!"127.0.0.1".equals(ip)) { 87 | hostIp = ia.getHostAddress(); 88 | break; 89 | } 90 | } 91 | } 92 | } catch (SocketException e) { 93 | e.printStackTrace(); 94 | } 95 | return hostIp; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/logger/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package logger_test 23 | 24 | import ( 25 | ol "github.com/ossrs/go-oryx-lib/logger" 26 | "os" 27 | ) 28 | 29 | func ExampleLogger_ToConsole() { 30 | // Simply log to console. 31 | ol.Info.Println(nil, "The log text.") 32 | ol.Trace.Println(nil, "The log text.") 33 | ol.Warn.Println(nil, "The log text.") 34 | ol.Error.Println(nil, "The log text.") 35 | 36 | // Use short aliases. 37 | ol.I(nil, "The log text.") 38 | ol.T(nil, "The log text.") 39 | ol.W(nil, "The log text.") 40 | ol.E(nil, "The log text.") 41 | 42 | // Use printf style log. 43 | ol.If(nil, "The log %v", "text") 44 | ol.Tf(nil, "The log %v", "text") 45 | ol.Wf(nil, "The log %v", "text") 46 | ol.Ef(nil, "The log %v", "text") 47 | } 48 | 49 | func ExampleLogger_ToFile() { 50 | // Open logger file and change the tank for logger. 51 | var err error 52 | var f *os.File 53 | if f, err = os.Open("sys.log"); err != nil { 54 | return 55 | } 56 | ol.Switch(f) 57 | 58 | // Use logger, which will write to file. 59 | ol.T(nil, "The log text.") 60 | 61 | // Close logger file when your application quit. 62 | defer ol.Close() 63 | } 64 | 65 | func ExampleLogger_SwitchFile() { 66 | // Initialize logger with file. 67 | var err error 68 | var f *os.File 69 | if f, err = os.Open("sys.log"); err != nil { 70 | return 71 | } 72 | ol.Switch(f) 73 | 74 | // When need to reap log file, 75 | // user must close current log file. 76 | ol.Close() 77 | // User can move the sys.log away. 78 | // Then reopen the log file and notify logger to use it. 79 | if f, err = os.Open("sys.log"); err != nil { 80 | return 81 | } 82 | // All logs between close and switch are dropped. 83 | ol.Switch(f) 84 | 85 | // Always close it. 86 | defer ol.Close() 87 | } 88 | 89 | // Each context is specified a connection, 90 | // which user must implement the interface. 91 | type cidContext int 92 | 93 | func (v cidContext) Cid() int { 94 | return int(v) 95 | } 96 | 97 | func ExampleLogger_ConnectionBased() { 98 | ctx := cidContext(100) 99 | ol.Info.Println(ctx, "The log text") 100 | ol.Trace.Println(ctx, "The log text.") 101 | ol.Warn.Println(ctx, "The log text.") 102 | ol.Error.Println(ctx, "The log text.") 103 | } 104 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/logger/example_go17_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // +build go1.7 23 | 24 | package logger_test 25 | 26 | import ( 27 | "context" 28 | ol "github.com/ossrs/go-oryx-lib/logger" 29 | ) 30 | 31 | func ExampleLogger_ContextGO17() { 32 | ctx := context.Background() 33 | 34 | ctx, cancel := context.WithCancel(ctx) 35 | defer cancel() 36 | 37 | // Wrap the context, to support CID. 38 | ctx = ol.WithContext(ctx) 39 | 40 | // We must wrap the context. 41 | // For each coroutine or request, we must use a context. 42 | go func(ctx context.Context) { 43 | ol.T(ctx, "Log with context") 44 | 45 | ctx, cancel := context.WithCancel(ctx) 46 | defer cancel() 47 | func(ctx context.Context) { 48 | ol.T(ctx, "Log in child function") 49 | }(ctx) 50 | }(ctx) 51 | } 52 | 53 | func ExampleLogger_MultipleContextGO17() { 54 | ctx := context.Background() 55 | 56 | pfn := func(ctx context.Context) { 57 | ol.T(ctx, "Log with context") 58 | 59 | ctx, cancel := context.WithCancel(ctx) 60 | defer cancel() 61 | func(ctx context.Context) { 62 | ol.T(ctx, "Log in child function") 63 | }(ctx) 64 | } 65 | 66 | // We must wrap the context. 67 | // For each coroutine or request, we must use a context. 68 | func(ctx context.Context) { 69 | ctx, cancel := context.WithCancel(ctx) 70 | defer cancel() 71 | 72 | // Wrap the context, to support CID. 73 | ctx = ol.WithContext(ctx) 74 | go pfn(ctx) 75 | }(ctx) 76 | 77 | // Another goroutine, use another context if they aren't in the same scope. 78 | func(ctx context.Context) { 79 | ctx, cancel := context.WithCancel(ctx) 80 | defer cancel() 81 | 82 | // Wrap the context, to support CID. 83 | ctx = ol.WithContext(ctx) 84 | go pfn(ctx) 85 | }(ctx) 86 | } 87 | 88 | func ExampleLogger_AliasContext() { 89 | // This is the source context. 90 | source := ol.WithContext(context.Background()) 91 | 92 | // We should inherit from the parent context. 93 | parent := context.Background() 94 | 95 | // However, we maybe need to create a context from parent, 96 | // but with the same cid of source. 97 | ctx := ol.AliasContext(parent, source) 98 | 99 | // Now use the context, which has the same cid of source, 100 | // and it belongs to the parent context tree. 101 | _ = ctx 102 | } 103 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/websocket/prepared.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Gorilla WebSocket Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // fork from https://github.com/gorilla/websocket 6 | package websocket 7 | 8 | import ( 9 | "bytes" 10 | "net" 11 | "sync" 12 | "time" 13 | ) 14 | 15 | // PreparedMessage caches on the wire representations of a message payload. 16 | // Use PreparedMessage to efficiently send a message payload to multiple 17 | // connections. PreparedMessage is especially useful when compression is used 18 | // because the CPU and memory expensive compression operation can be executed 19 | // once for a given set of compression options. 20 | type PreparedMessage struct { 21 | messageType int 22 | data []byte 23 | err error 24 | mu sync.Mutex 25 | frames map[prepareKey]*preparedFrame 26 | } 27 | 28 | // prepareKey defines a unique set of options to cache prepared frames in PreparedMessage. 29 | type prepareKey struct { 30 | isServer bool 31 | compress bool 32 | compressionLevel int 33 | } 34 | 35 | // preparedFrame contains data in wire representation. 36 | type preparedFrame struct { 37 | once sync.Once 38 | data []byte 39 | } 40 | 41 | // NewPreparedMessage returns an initialized PreparedMessage. You can then send 42 | // it to connection using WritePreparedMessage method. Valid wire 43 | // representation will be calculated lazily only once for a set of current 44 | // connection options. 45 | func NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) { 46 | pm := &PreparedMessage{ 47 | messageType: messageType, 48 | frames: make(map[prepareKey]*preparedFrame), 49 | data: data, 50 | } 51 | 52 | // Prepare a plain server frame. 53 | _, frameData, err := pm.frame(prepareKey{isServer: true, compress: false}) 54 | if err != nil { 55 | return nil, err 56 | } 57 | 58 | // To protect against caller modifying the data argument, remember the data 59 | // copied to the plain server frame. 60 | pm.data = frameData[len(frameData)-len(data):] 61 | return pm, nil 62 | } 63 | 64 | func (pm *PreparedMessage) frame(key prepareKey) (int, []byte, error) { 65 | pm.mu.Lock() 66 | frame, ok := pm.frames[key] 67 | if !ok { 68 | frame = &preparedFrame{} 69 | pm.frames[key] = frame 70 | } 71 | pm.mu.Unlock() 72 | 73 | var err error 74 | frame.once.Do(func() { 75 | // Prepare a frame using a 'fake' connection. 76 | // TODO: Refactor code in conn.go to allow more direct construction of 77 | // the frame. 78 | mu := make(chan bool, 1) 79 | mu <- true 80 | var nc prepareConn 81 | c := &Conn{ 82 | conn: &nc, 83 | mu: mu, 84 | isServer: key.isServer, 85 | compressionLevel: key.compressionLevel, 86 | enableWriteCompression: true, 87 | writeBuf: make([]byte, defaultWriteBufferSize+maxFrameHeaderSize), 88 | } 89 | if key.compress { 90 | c.newCompressionWriter = compressNoContextTakeover 91 | } 92 | err = c.WriteMessage(pm.messageType, pm.data) 93 | frame.data = nc.buf.Bytes() 94 | }) 95 | return pm.messageType, frame.data, err 96 | } 97 | 98 | type prepareConn struct { 99 | buf bytes.Buffer 100 | net.Conn 101 | } 102 | 103 | func (pc *prepareConn) Write(p []byte) (int, error) { return pc.buf.Write(p) } 104 | func (pc *prepareConn) SetWriteDeadline(t time.Time) error { return nil } 105 | -------------------------------------------------------------------------------- /ruby/server.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require 'optparse' 4 | 5 | options = {} 6 | option_parser = OptionParser.new do |opts| 7 | opts.banner = 'here is help messages of the command line tool.' 8 | 9 | opts.on('-l PORT', '--listen Port', 'Server listen port') do |value| 10 | options[:listen] = value 11 | end 12 | 13 | opts.on('-a APPID', '--appid AppID', 'Application ID') do |value| 14 | options[:appid] = value 15 | end 16 | 17 | opts.on('-k APPKEY', '--appkey AppKey', 'Application Secret Key') do |value| 18 | options[:appkey] = value 19 | end 20 | 21 | opts.on('-g URL', '--gslb URL', 'GSLB service URL') do |value| 22 | options[:gslb] = value 23 | end 24 | end.parse! 25 | 26 | puts "Listen=#{options[:listen]}, AppID=#{options[:appid]}, AppKey=#{options[:appkey]}, GSLB=#{options[:gslb]}" #options.inspect 27 | 28 | require 'sinatra' 29 | require 'digest' 30 | 31 | set :port, options[:listen] # default port: 4567 32 | 33 | before do 34 | headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS' 35 | headers['Access-Control-Allow-Origin'] = '*' 36 | headers['Access-Control-Allow-Headers'] = 'accept, authorization, origin' 37 | end 38 | 39 | options '*' do 40 | response.headers['Allow'] = 'HEAD,GET,PUT,DELETE,OPTIONS,POST' 41 | response.headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Cache-Control, Accept' 42 | end 43 | 44 | get '/app/v1/login' do 45 | login options, params 46 | end 47 | 48 | post '/app/v1/login' do 49 | login options, params 50 | end 51 | 52 | def create_user_id(channel_id, user) 53 | Digest::SHA256.hexdigest("#{channel_id}/#{user}")[0, 16] 54 | end 55 | 56 | def create_token(app_id, app_key, channel_id, user_id, nonce, timestamp) 57 | Digest::SHA256.hexdigest "#{app_id}#{app_key}#{channel_id}#{user_id}#{nonce}#{timestamp}" 58 | end 59 | 60 | def login(options, params) 61 | # Fetch configure info. 62 | app_id = options[:appid] 63 | app_key = options[:appkey] 64 | gslb = options[:gslb] 65 | 66 | # Get request parameters. 67 | channel_id = params['room'] 68 | user = params['user'] 69 | 70 | # Generate user id 71 | user_id = create_user_id(channel_id, user) 72 | 73 | # Warning: nonce support the AppKey generated token. 74 | # the Nonce should be prefix with 'AK-' otherwise the joining verification will failed. 75 | # eg. nonce: "AK-0464002093ce3dd010cb05356c8b1d0f". 76 | nonce = "AK-#{SecureRandom.uuid}" 77 | 78 | # Warning: timestamp is the token expiration time. 79 | # User can custom defined the expire time of token. 80 | # eg, Expires in two days. timestamp: 1559890860. 81 | expire = Time.now + 60*60*24*2 # expired in two days. 82 | timestamp = (expire.to_f * 1000).to_i/1000 83 | 84 | # Generate token 85 | token = create_token(app_id, app_key, channel_id, user_id, nonce, timestamp) 86 | 87 | username = "#{user_id}?appid=#{app_id}&channel=#{channel_id}&nonce=#{nonce}×tamp=#{timestamp}" 88 | 89 | puts "Login: appID=#{app_id}, appKey=#{app_key}, channelID=#{channel_id}, userID=#{user_id}, nonce=#{nonce}, timestamp=#{timestamp}, user=#{user}, userName=#{username}, token=#{token}" 90 | 91 | JSON.generate({ 92 | :code => 0, 93 | :data => { 94 | :appid => app_id, 95 | :userid => user_id, 96 | :gslb => [gslb], 97 | :token => token, 98 | :nonce => nonce, 99 | :timestamp => timestamp, 100 | :turn => { 101 | :username => username, 102 | :password => token 103 | } 104 | } 105 | }) 106 | end 107 | 108 | -------------------------------------------------------------------------------- /golang/vendor/github.com/satori/go.uuid/uuid_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013-2018 by Maxim Bublis 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining 4 | // a copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to 8 | // permit persons to whom the Software is furnished to do so, subject to 9 | // the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be 12 | // included in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package uuid 23 | 24 | import ( 25 | "bytes" 26 | "testing" 27 | 28 | . "gopkg.in/check.v1" 29 | ) 30 | 31 | // Hook up gocheck into the "go test" runner. 32 | func TestUUID(t *testing.T) { TestingT(t) } 33 | 34 | type testSuite struct{} 35 | 36 | var _ = Suite(&testSuite{}) 37 | 38 | func (s *testSuite) TestBytes(c *C) { 39 | u := UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} 40 | 41 | bytes1 := []byte{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8} 42 | 43 | c.Assert(bytes.Equal(u.Bytes(), bytes1), Equals, true) 44 | } 45 | 46 | func (s *testSuite) TestString(c *C) { 47 | c.Assert(NamespaceDNS.String(), Equals, "6ba7b810-9dad-11d1-80b4-00c04fd430c8") 48 | } 49 | 50 | func (s *testSuite) TestEqual(c *C) { 51 | c.Assert(Equal(NamespaceDNS, NamespaceDNS), Equals, true) 52 | c.Assert(Equal(NamespaceDNS, NamespaceURL), Equals, false) 53 | } 54 | 55 | func (s *testSuite) TestVersion(c *C) { 56 | u := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} 57 | c.Assert(u.Version(), Equals, V1) 58 | } 59 | 60 | func (s *testSuite) TestSetVersion(c *C) { 61 | u := UUID{} 62 | u.SetVersion(4) 63 | c.Assert(u.Version(), Equals, V4) 64 | } 65 | 66 | func (s *testSuite) TestVariant(c *C) { 67 | u1 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} 68 | c.Assert(u1.Variant(), Equals, VariantNCS) 69 | 70 | u2 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} 71 | c.Assert(u2.Variant(), Equals, VariantRFC4122) 72 | 73 | u3 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} 74 | c.Assert(u3.Variant(), Equals, VariantMicrosoft) 75 | 76 | u4 := UUID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} 77 | c.Assert(u4.Variant(), Equals, VariantFuture) 78 | } 79 | 80 | func (s *testSuite) TestSetVariant(c *C) { 81 | u := UUID{} 82 | u.SetVariant(VariantNCS) 83 | c.Assert(u.Variant(), Equals, VariantNCS) 84 | u.SetVariant(VariantRFC4122) 85 | c.Assert(u.Variant(), Equals, VariantRFC4122) 86 | u.SetVariant(VariantMicrosoft) 87 | c.Assert(u.Variant(), Equals, VariantMicrosoft) 88 | u.SetVariant(VariantFuture) 89 | c.Assert(u.Variant(), Equals, VariantFuture) 90 | } 91 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/README.md: -------------------------------------------------------------------------------- 1 | # go-oryx-lib 2 | 3 | [![Build Status](https://travis-ci.org/ossrs/go-oryx-lib.svg?branch=master)](https://travis-ci.org/ossrs/go-oryx-lib) 4 | [![codecov](https://codecov.io/gh/ossrs/go-oryx-lib/branch/master/graph/badge.svg)](https://codecov.io/gh/ossrs/go-oryx-lib) 5 | 6 | This library is exported by server [go-oryx](https://github.com/ossrs/go-oryx). 7 | 8 | ## Requires 9 | 10 | [GO1.4](https://golang.org/dl/)+ 11 | 12 | ## Packages 13 | 14 | The library provides packages about network and multiple media processing: 15 | 16 | - [x] [logger](logger/example_test.go): Connection-Oriented logger for application server. 17 | - [x] [json](json/example_test.go): Json+ supports c and c++ style comments. 18 | - [x] [options](options/example_test.go): Frequently used service options with config file. 19 | - [x] [http](http/example_test.go): For http response with error, jsonp and std reponse. 20 | - [x] [asprocess](asprocess/example_test.go): The associate-process, for SRS/BMS to work with external process. 21 | - [x] [kxps](kxps/example_test.go): The k-some-ps, for example, kbps, krps. 22 | - [x] [https](https/example_test.go): For https server over [lego/acme](https://github.com/xenolf/lego/tree/master/acme) of [letsencrypt](https://letsencrypt.org/). 23 | - [x] [gmoryx](gmoryx/README.md): A [gomobile](https://github.com/golang/mobile) API for go-oryx-lib. 24 | - [x] [flv](flv/example_test.go): The FLV muxer and demuxer, for oryx. 25 | - [x] [errors](errors/example_test.go): Fork from [pkg/errors](https://github.com/pkg/errors), a complex error with message and stack, read [article](https://gocn.io/article/348). 26 | - [x] [aac](aac/example_test.go): The AAC utilities to demux and mux AAC RAW data, for oryx. 27 | - [x] [websocket](https://golang.org/x/net/websocket): Fork from [websocket](https://github.com/gorilla/websocket/tree/v1.2.0). 28 | - [x] [rtmp](rtmp/example_test.go): The RTMP protocol stack, for oryx. 29 | - [x] [avc](avc/example_test.go): The AVC utilities to demux and mux AVC RAW data, for oryx. 30 | - [ ] [sip](sip/example_test.go): A [sip RFC3261](https://tools.ietf.org/html/rfc3261) library for WebRTC signaling. 31 | - [ ] [turn](turn/example_test.go): A [turn RFC5766](https://tools.ietf.org/html/rfc5766) library for WebRTC and SFU. 32 | 33 | > Remark: For library, please never use `logger`, use `errors` instead. 34 | 35 | Other multiple media libraries in golang: 36 | 37 | - [x] [go-speex](https://github.com/winlinvip/go-speex): A go binding for [speex](https://speex.org/). 38 | - [x] [go-fdkaac](https://github.com/winlinvip/go-fdkaac): A go binding for [fdk-aac](https://github.com/mstorsjo/fdk-aac). 39 | - [x] [go-aresample](https://github.com/winlinvip/go-aresample): Resample the audio PCM. 40 | 41 | ## License 42 | 43 | This library just depends on golang standard library, 44 | we do this by copying the code of other libraries, 45 | while all the licenses are liberal: 46 | 47 | 1. [go-oryx-lib](LICENSE) uses [MIT License](https://github.com/ossrs/go-oryx-lib/blob/master/LICENSE). 48 | 1. [pkg/errors](errors/LICENSE) uses [BSD 2-clause "Simplified" License](https://github.com/pkg/errors/blob/master/LICENSE). 49 | 1. [acme](https/acme/LICENSE) uses [MIT License](https://github.com/xenolf/lego/blob/master/LICENSE). 50 | 1. [jose](https/jose/LICENSE) uses [Apache License 2.0](https://github.com/square/go-jose/blob/v1.1.0/LICENSE). 51 | 1. [letsencrypt](https/letsencrypt/LICENSE) uses [BSD 3-clause "New" or "Revised" License](https://github.com/rsc/letsencrypt/blob/master/LICENSE). 52 | 1. [websocket](https://github.com/gorilla/websocket) uses [BSD 2-clause "Simplified" License](https://github.com/gorilla/websocket/blob/master/LICENSE). 53 | 54 | Winlin 2016 55 | -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | # AppServer 2 | 3 | Python AppServer for AliRTC. 4 | 5 | ## CentOS6 6 | 7 | 1. Setup Python: 8 | 9 | ``` 10 | (pip --version 2>/dev/null || sudo yum install -y python-pip) && 11 | (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) 12 | ``` 13 | 14 | 2. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 15 | 16 | ``` 17 | AppID: xxxxxxxx 18 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 19 | ``` 20 | 21 | 3. Start AppServer, **use your information**: 22 | 23 | ``` 24 | ./server.py --listen=8080 --appid=xxxxxxxx \ 25 | --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ 26 | --gslb=https://rgslb.rtc.aliyuncs.com 27 | ``` 28 | 29 | 30 | 4. Verify your AppServer by [VerifyServer](../verify/README.md). 31 | 32 | ![AppServer Success](images/app-ok.png) 33 | 34 | ![AppServer Failed](images/app-failed.png) 35 | 36 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 37 | 38 | > Remark: Please use your AppServer IP instead by `ifconfig eth0`. 39 | 40 | ## MacPro 41 | 42 | 1. Install `pip` for Python: 43 | 44 | ``` 45 | pip --version 2>/dev/null || sudo easy_install pip 46 | ``` 47 | 48 | or 49 | 50 | ``` 51 | url='https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz#sha256=f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68' && 52 | pip --version 2>/dev/null || (wget $url -O pip-10.0.1.tar.gz 53 | tar xf pip-10.0.1.tar.gz && cd pip-10.0.1 && 54 | sudo python setup.py install) 55 | ``` 56 | 57 | 2. Setup Python: 58 | 59 | ``` 60 | (rm -rf CherryPy-3.2.2 && unzip -q CherryPy-3.2.2.zip && cd CherryPy-3.2.2 && python setup.py install --user) 61 | ``` 62 | 63 | 3. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 64 | 65 | ``` 66 | AppID: xxxxxxxx 67 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 68 | ``` 69 | 70 | 4. Start AppServer, **use your information**: 71 | 72 | ``` 73 | ./server.py --listen=8080 --appid=xxxxxxxx \ 74 | --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ 75 | --gslb=https://rgslb.rtc.aliyuncs.com 76 | ``` 77 | 78 | 5.Verify your AppServer by [VerifyServer](../verify/README.md). 79 | 80 | ![AppServer Success](images/app-ok.png) 81 | 82 | ![AppServer Failed](images/app-failed.png) 83 | 84 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 85 | 86 | > Remark: Please use your AppServer IP instead by `ifconfig en0`. 87 | 88 | ## Windows 89 | 90 | 1. Unzip `CherryPy-3.2.2.zip` then install by: 91 | 92 | ``` 93 | cd CherryPy-3.2.2 94 | python setup.py install --user 95 | ``` 96 | 97 | 2. Download `pycryptodome` from [here](https://pypi.org/project/pycryptodome/#files), then unzip and install by: 98 | 99 | ``` 100 | cd pycryptodome-* 101 | python setup.py install --user 102 | ``` 103 | 104 | 3. Create APP and APPKey from [here](https://rtc.console.aliyun.com/#/manage): 105 | 106 | ``` 107 | AppID: xxxxxxxx 108 | AppKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 109 | ``` 110 | 111 | 4. Start AppServer, **use your information**: 112 | 113 | ``` 114 | python server.py --listen=8080 --appid=xxxxxxxx \ 115 | --appkey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ 116 | --gslb=https://rgslb.rtc.aliyuncs.com 117 | ``` 118 | 119 | 5. Verify your AppServer by [VerifyServer](../verify/README.md). 120 | 121 | ![AppServer Success](images/app-ok.png) 122 | 123 | ![AppServer Failed](images/app-failed.png) 124 | 125 | > Remark: You can setup client native SDK by `http://30.2.228.19:8080/app/v1`. 126 | 127 | > Remark: Please use your AppServer IP instead by `ipconfig`. 128 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/json/example_test.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | package json_test 23 | 24 | import ( 25 | "bytes" 26 | "encoding/json" 27 | "fmt" 28 | oj "github.com/ossrs/go-oryx-lib/json" 29 | "io/ioutil" 30 | ) 31 | 32 | func ExampleJson() { 33 | r := bytes.NewReader([]byte(` 34 | { 35 | "code":0, // An int error code, where 0 is success. 36 | "data": /*An interface{} data.*/ "There is no error", 37 | "json+": true // Both "" and '' is ok for json+ 38 | } 39 | `)) 40 | 41 | j := json.NewDecoder(oj.NewJsonPlusReader(r)) 42 | 43 | obj := struct { 44 | Code int `json:"code"` 45 | Data string `json:"data"` 46 | JsonPlus bool `json:"json+"` 47 | }{} 48 | if err := j.Decode(&obj); err != nil { 49 | fmt.Println("json+ decode failed, err is", err) 50 | return 51 | } 52 | 53 | // User can decode more objects from reader. 54 | 55 | fmt.Println("Code:", obj.Code) 56 | fmt.Println("Data:", obj.Data) 57 | fmt.Println("JsonPlus:", obj.JsonPlus) 58 | 59 | // Output: 60 | // Code: 0 61 | // Data: There is no error 62 | // JsonPlus: true 63 | } 64 | 65 | func ExampleJson_Unmarshal() { 66 | s := `{"code":100,"data":"There is something error"}` 67 | var obj interface{} 68 | if err := oj.Unmarshal(bytes.NewBuffer([]byte(s)), &obj); err != nil { 69 | fmt.Println("json+ unmarshal failed, err is", err) 70 | return 71 | } 72 | 73 | if obj, ok := obj.(map[string]interface{}); ok { 74 | fmt.Println("Code:", obj["code"]) 75 | fmt.Println("Data:", obj["data"]) 76 | } 77 | 78 | // Output: 79 | // Code: 100 80 | // Data: There is something error 81 | } 82 | 83 | func ExampleJson_NewCommentReader() { 84 | // The following is comment: 85 | // # xxxx \n 86 | // Where the following is string: 87 | // 'xxx' 88 | // "xxx" 89 | // That is, the following is not a comment: 90 | // "xxx'xx'xx#xxx" 91 | r := bytes.NewReader([]byte(` 92 | # for which cannot identify the required vhost. 93 | vhost __defaultVhost__ { 94 | } 95 | `)) 96 | cr := oj.NewCommentReader(r, 97 | [][]byte{[]byte("'"), []byte("\""), []byte("#")}, 98 | [][]byte{[]byte("'"), []byte("\""), []byte("\n")}, 99 | []bool{false, false, true}, 100 | []bool{true, true, false}, 101 | ) 102 | if o, err := ioutil.ReadAll(cr); err != nil { 103 | fmt.Println("json+ read without comments failed, err is", err) 104 | return 105 | } else { 106 | fmt.Println(string(o)) 107 | } 108 | 109 | // Output: 110 | // vhost __defaultVhost__ { 111 | // } 112 | } 113 | -------------------------------------------------------------------------------- /golang/vendor/github.com/ossrs/go-oryx-lib/options/options.go: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2013-2017 Oryx(ossrs) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // The oryx options package parse the options with config file. 23 | // -c, to specifies the config file. 24 | // -v, to print version and quit. 25 | // -g, to print signature and quit. 26 | // -h, to print help and quit. 27 | // We return the parsed config file path. 28 | package options 29 | 30 | import ( 31 | "flag" 32 | "fmt" 33 | "os" 34 | ) 35 | 36 | // parse the argv with config, version and signature. 37 | // @param rcf The recomment config file path. 38 | // @param version The vesion of application, such as 1.2.3 39 | // @param signature The signature of application, such as SRS/1.2.3 40 | func ParseArgv(rcf, version, signature string) (confFile string) { 41 | // the args format: 42 | // -c conf/ory.json 43 | // --c conf/oryx.json 44 | // -c=conf/oryx.json 45 | // --c=conf/oryx.json 46 | // --conf=conf/oryx.json 47 | if true { 48 | dv := "" 49 | ua := "The config file" 50 | flag.StringVar(&confFile, "c", dv, ua) 51 | flag.StringVar(&confFile, "conf", dv, ua) 52 | } 53 | 54 | var showVersion bool 55 | if true { 56 | dv := false 57 | ua := "Print version" 58 | flag.BoolVar(&showVersion, "v", dv, ua) 59 | flag.BoolVar(&showVersion, "V", dv, ua) 60 | flag.BoolVar(&showVersion, "version", dv, ua) 61 | } 62 | 63 | var showSignature bool 64 | if true { 65 | dv := false 66 | ua := "print signature" 67 | flag.BoolVar(&showSignature, "g", dv, ua) 68 | flag.BoolVar(&showSignature, "signature", dv, ua) 69 | } 70 | 71 | flag.Usage = func() { 72 | fmt.Println(signature) 73 | fmt.Println(fmt.Sprintf("Usage: %v [-c|--conf ] [-?|-h|--help] [-v|-V|--version] [-g|--signature]", os.Args[0])) 74 | fmt.Println(fmt.Sprintf(" -c, --conf filename : The config file path")) 75 | fmt.Println(fmt.Sprintf(" -?, -h, --help : Show this help and exit")) 76 | fmt.Println(fmt.Sprintf(" -v, -V, --version : Print version and exit")) 77 | fmt.Println(fmt.Sprintf(" -g, --signature : Print signature and exit")) 78 | fmt.Println(fmt.Sprintf("For example:")) 79 | fmt.Println(fmt.Sprintf(" %v -c %v", os.Args[0], rcf)) 80 | } 81 | flag.Parse() 82 | 83 | if showVersion { 84 | fmt.Fprintln(os.Stderr, version) 85 | os.Exit(0) 86 | } 87 | 88 | if showSignature { 89 | fmt.Fprintln(os.Stderr, signature) 90 | os.Exit(0) 91 | } 92 | 93 | if len(confFile) == 0 { 94 | flag.Usage() 95 | os.Exit(-1) 96 | } 97 | 98 | return 99 | } 100 | -------------------------------------------------------------------------------- /verify/html/js/bravo_alert/demo/demo_alert_complex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bravo alert 6 | 7 | 8 | 9 |
10 |

bravo alert complex demo

11 |

1.展示更复杂的警告框内容

12 |
13 | 14 |

Oh snap! You got an error!

15 |

Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

16 |

17 | Take this action Or do this 18 |

19 |
20 |
21 |

2.alert close与closed事件监听

22 |

bravo-alert-close="your_close_callback()"close事件callback函数,添加到attr

23 |

bravo-alert-closed="your_closed_callback()"closed事件callback函数,添加到attr

24 |
25 |
27 | 28 |

Oh snap! You got an error!

29 |

Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

30 |

31 | Take this action Or do this 32 |

33 |
34 |
35 | 36 | 37 | 60 | 61 | --------------------------------------------------------------------------------