Skip to content

Commit

Permalink
Add LICENSE and expose some services
Browse files Browse the repository at this point in the history
CI all seems to be working
  • Loading branch information
Sean-Der committed Jan 28, 2019
1 parent 16eca97 commit bf0133e
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/assert-contributors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -e

# Unshallow the repo, this check doesn't work with this enabled
# https://github.com/travis-ci/travis-ci/issues/3412
if [ -f $(git rev-parse --git-dir)/shallow ]; then
git fetch --unshallow || true
fi

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

CONTRIBUTORS=()
EXCLUDED_CONTIBUTORS=('John R. Bradley')
MISSING_CONTIBUTORS=()

shouldBeIncluded () {
for i in "${EXCLUDED_CONTIBUTORS[@]}"
do
if [ "$i" == "$1" ] ; then
return 1
fi
done
return 0
}


IFS=$'\n' #Only split on newline
for contributor in $(git log --format='%aN' | sort -u)
do
if shouldBeIncluded $contributor; then
if ! grep -q "$contributor" "$SCRIPT_PATH/../README.md"; then
MISSING_CONTIBUTORS+=("$contributor")
fi
fi
done
unset IFS

if [ ${#MISSING_CONTIBUTORS[@]} -ne 0 ]; then
echo "Please add the following contributors to the README"
for i in "${MISSING_CONTIBUTORS[@]}"
do
echo "$i"
done
exit 1
fi
60 changes: 60 additions & 0 deletions .github/lint-commit-message.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -e

display_commit_message_error() {
cat << EndOfMessage
$1
-------------------------------------------------
The preceding commit message is invalid
it failed '$2' of the following checks
* Separate subject from body with a blank line
* Limit the subject line to 50 characters
* Capitalize the subject line
* Do not end the subject line with a period
* Wrap the body at 72 characters
EndOfMessage

exit 1
}

lint_commit_message() {
if [[ "$(echo "$1" | awk 'NR == 2 {print $1;}' | wc -c)" -ne 1 ]]; then
display_commit_message_error "$1" 'Separate subject from body with a blank line'
fi

if [[ "$(echo "$1" | head -n1 | wc -m)" -gt 50 ]]; then
display_commit_message_error "$1" 'Limit the subject line to 50 characters'
fi

if [[ ! $1 =~ ^[A-Z] ]]; then
display_commit_message_error "$1" 'Capitalize the subject line'
fi

if [[ "$(echo "$1" | awk 'NR == 1 {print substr($0,length($0),1)}')" == "." ]]; then
display_commit_message_error "$1" 'Do not end the subject line with a period'
fi

if [[ "$(echo "$1" | awk '{print length}' | sort -nr | head -1)" -gt 72 ]]; then
display_commit_message_error "$1" 'Wrap the body at 72 characters'
fi
}

if [ "$#" -eq 1 ]; then
if [ ! -f "$1" ]; then
echo "$0 was passed one argument, but was not a valid file"
exit 1
fi
lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")"
else
# TRAVIS_COMMIT_RANGE is empty for initial branch commit
if [[ "${TRAVIS_COMMIT_RANGE}" != *"..."* ]]; then
parent=$(git log -n 1 --format="%P" ${TRAVIS_COMMIT_RANGE})
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE}...$parent"
fi

for commit in $(git rev-list ${TRAVIS_COMMIT_RANGE}); do
lint_commit_message "$(git log --format="%B" -n 1 $commit)"
done
fi
16 changes: 16 additions & 0 deletions .github/lint-disallowed-functions-in-library.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e

# Disallow usages of functions that cause the program to exit in the library code
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
EXCLUDE_DIRECTORIES="--exclude-dir=examples --exclude-dir=.git --exclude-dir=.github "
DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(')


for disallowedFunction in "${DISALLOWED_FUNCTIONS[@]}"
do
if grep -R $EXCLUDE_DIRECTORIES -e "$disallowedFunction" "$SCRIPT_PATH/.." | grep -v -e '_test.go' -e 'nolint'; then
echo "$disallowedFunction may only be used in example code"
exit 1
fi
done
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### JetBrains IDE ###
#####################
.idea/

### Emacs Temporary Files ###
#############################
*~

### Folders ###
###############
bin/
vendor/

### Files ###
#############
*.ivf
tags
cover.out
14 changes: 14 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
linters-settings:
govet:
check-shadowing: true
misspell:
locale: US

linters:
enable-all: true
disable:
- lll
- maligned

issues:
exclude-use-default: false
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
language: go

go:
- "1.x" # use the latest Go release

env:
- GO111MODULE=on

notifications:
email: false

before_script:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.13
- go get github.com/mattn/goveralls

script:
- golangci-lint run ./...
- go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./...
- goveralls -coverprofile=cover.out -service=travis-ci
- bash .github/assert-contributors.sh
- bash .github/lint-disallowed-functions-in-library.sh
- bash .github/lint-commit-message.sh
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<h1 align="center">
<br>
Pion RTP
<br>
</h1>
<h4 align="center">A Go implementation of RTP</h4>
<p align="center">
<a href="https://pion.ly"><img src="https://img.shields.io/badge/pion-rtp-gray.svg?longCache=true&colorB=brightgreen" alt="Pion RTP"></a>
<a href="https://sourcegraph.com/github.com/pions/rtp?badge"><img src="https://sourcegraph.com/github.com/pions/rtp/-/badge.svg" alt="Sourcegraph Widget"></a>
<a href="http://gophers.slack.com/messages/pion"><img src="https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen" alt="Slack Widget"></a>
<a href="https://waffle.io/pions/webrtc"><img src="https://img.shields.io/badge/pm-waffle-gray.svg?longCache=true&colorB=brightgreen" alt="Waffle board"></a>
<br>
<a href="https://travis-ci.org/pions/rtp"><img src="https://travis-ci.org/pions/rtp.svg?branch=master" alt="Build Status"></a>
<a href="https://godoc.org/github.com/pions/rtp"><img src="https://godoc.org/github.com/pions/rtp?status.svg" alt="GoDoc"></a>
<a href="https://coveralls.io/github/pions/rtp"><img src="https://coveralls.io/repos/github/pions/rtp/badge.svg" alt="Coverage Status"></a>
<a href="https://goreportcard.com/report/github.com/pions/rtp"><img src="https://goreportcard.com/badge/github.com/pions/rtp" alt="Go Report Card"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
</p>
<br>

See [DESIGN.md](DESIGN.md) for an overview of features and future goals.

### Roadmap
The library is used as a part of our WebRTC implementation. Please refer to that [roadmap](https://github.com/pions/webrtc/issues/9) to track our major milestones.

### Community
Pion has an active community on the [Golang Slack](https://invite.slack.golangbridge.org/). Sign up and join the **#pion** channel for discussions and support. You can also use [Pion mailing list](https://groups.google.com/forum/#!forum/pion).

We are always looking to support **your projects**. Please reach out if you have something to build!

If you need commercial support or don't want to use public methods you can contact us at [[email protected]](mailto:[email protected])

### Contributing
Check out the **[contributing wiki](https://github.com/pions/webrtc/wiki/Contributing)** to join the group of amazing people making this project possible:

* [John Bradley](https://github.com/kc5nra) - *Original Author*
* [Sean DuBois](https://github.com/Sean-Der) - *Original Author*
* [Woodrow Douglass](https://github.com/wdouglass) *RTCP, RTP improvements, G.722 support, Bugfixes*
* [Michael MacDonald](https://github.com/mjmac)

### License
MIT License - see [LICENSE](LICENSE) for full text
2 changes: 1 addition & 1 deletion codecs/opus_packet.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package codecs

import "github.com/pions/webrtc/pkg/rtp"
import "github.com/pions/rtp"

// OpusPayloader payloads Opus packets
type OpusPayloader struct{}
Expand Down
2 changes: 1 addition & 1 deletion codecs/vp8_packet.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package codecs

import "github.com/pions/webrtc/pkg/rtp"
import "github.com/pions/rtp"

// VP8Payloader payloads VP8 packets
type VP8Payloader struct{}
Expand Down

0 comments on commit bf0133e

Please sign in to comment.