├── CONTRIBUTE.md ├── DEPENDENCIES.txt ├── Godeps ├── Godeps.json └── Readme ├── LICENSE.txt ├── README.md ├── bash-install ├── 1-install.sh ├── 2-install.sh ├── nginx-php5.conf └── nginx-php7.conf ├── database.go ├── docs ├── api.png ├── arrow.png ├── bullet.png ├── conf.py ├── configuration.rst ├── gosint.gif ├── index.rst ├── installation.rst ├── use.rst └── x.png ├── feeds.go ├── gosint.gif ├── logo.go ├── main.go ├── orchestration.go ├── structures.go ├── vendor ├── github.com │ ├── ammario │ │ └── ipisp │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── asn.go │ │ │ ├── client.go │ │ │ ├── dns_client.go │ │ │ ├── name.go │ │ │ ├── response.go │ │ │ └── whois_client.go │ ├── cenkalti │ │ └── backoff │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── backoff.go │ │ │ ├── exponential.go │ │ │ ├── retry.go │ │ │ └── ticker.go │ ├── google │ │ └── go-querystring │ │ │ ├── LICENSE │ │ │ └── query │ │ │ └── encode.go │ ├── gorilla │ │ ├── context │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── context.go │ │ │ └── doc.go │ │ └── mux │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── context_gorilla.go │ │ │ ├── context_native.go │ │ │ ├── doc.go │ │ │ ├── mux.go │ │ │ ├── regexp.go │ │ │ └── route.go │ ├── johngb │ │ └── langreg │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── langreg.go │ │ │ ├── language.go │ │ │ ├── language_code_info.go │ │ │ ├── region.go │ │ │ ├── region_code_info.go │ │ │ └── wercker.yml │ ├── moul │ │ └── http2curl │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ └── http2curl.go │ ├── mvdan │ │ └── xurls │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── regex.go │ │ │ ├── schemes.go │ │ │ ├── tlds.go │ │ │ ├── tlds_pseudo.go │ │ │ └── xurls.go │ ├── parnurzeal │ │ └── gorequest │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── CHANGELOG │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── main.go │ ├── pkg │ │ └── errors │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── appveyor.yml │ │ │ ├── errors.go │ │ │ └── stack.go │ └── rs │ │ └── xid │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ └── id.go ├── golang.org │ └── x │ │ └── net │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── PATENTS │ │ ├── context │ │ ├── context.go │ │ ├── go17.go │ │ └── pre_go17.go │ │ └── publicsuffix │ │ ├── gen.go │ │ ├── list.go │ │ └── table.go └── gopkg.in │ ├── mgo.v2 │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── auth.go │ ├── bson │ │ ├── LICENSE │ │ ├── bson.go │ │ ├── decimal.go │ │ ├── decode.go │ │ ├── encode.go │ │ └── json.go │ ├── bulk.go │ ├── cluster.go │ ├── doc.go │ ├── gridfs.go │ ├── internal │ │ ├── json │ │ │ ├── LICENSE │ │ │ ├── decode.go │ │ │ ├── encode.go │ │ │ ├── extension.go │ │ │ ├── fold.go │ │ │ ├── indent.go │ │ │ ├── scanner.go │ │ │ ├── stream.go │ │ │ └── tags.go │ │ ├── sasl │ │ │ ├── sasl.c │ │ │ ├── sasl.go │ │ │ ├── sasl_windows.c │ │ │ ├── sasl_windows.go │ │ │ ├── sasl_windows.h │ │ │ ├── sspi_windows.c │ │ │ └── sspi_windows.h │ │ └── scram │ │ │ └── scram.go │ ├── log.go │ ├── queue.go │ ├── raceoff.go │ ├── raceon.go │ ├── saslimpl.go │ ├── saslstub.go │ ├── server.go │ ├── session.go │ ├── socket.go │ └── stats.go │ └── robfig │ └── cron.v2 │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── constantdelay.go │ ├── cron.go │ ├── doc.go │ ├── parser.go │ └── spec.go ├── web.go └── website ├── ad-hoc.php ├── inc ├── css │ ├── animate.css │ ├── bootstrap-tokenfield.min.css │ ├── bootstrap.min.css │ ├── dataTables.cellEdit.js │ ├── dragula.min.css │ ├── index.php │ ├── jquery.dynatable.css │ ├── jquery.modal.min.css │ ├── mycss.css │ └── simple-sidebar.css ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ ├── glyphicons-halflings-regular.woff2 │ └── index.php ├── img │ └── index.php ├── index.php ├── js │ ├── adHoc │ │ ├── adHoc.js │ │ └── index.php │ ├── dataTables │ │ ├── dataTables-plugins.js │ │ ├── index.php │ │ ├── jquery.dataTables.js │ │ └── moment.min.js │ ├── general │ │ ├── bootstrap-tokenfield.js │ │ ├── bootstrap.min.js │ │ ├── generate.js │ │ ├── index.php │ │ ├── jquery-1.9.1.min.js │ │ ├── jquery.modal.min.js │ │ └── jquery.noty.packaged.min.js │ ├── index.php │ ├── layouts │ │ ├── index.php │ │ └── topRight.js │ ├── metrics │ │ ├── index.php │ │ └── metrics.js │ ├── postProcessing │ │ ├── index.php │ │ └── postProcessing.js │ ├── preProcessing │ │ ├── index.php │ │ └── preProcessing.js │ ├── recipe │ │ ├── index.php │ │ └── recipe.js │ ├── settings │ │ ├── index.php │ │ └── settings.js │ └── transferStation │ │ ├── index.php │ │ └── transferStation.js └── php │ ├── footer.php │ ├── header.php │ ├── index.php │ ├── sidebar.php │ └── title-selector.php ├── index.php ├── metrics.php ├── post-processing.php ├── pre-processing.php ├── recipe.php ├── settings.php └── transfer-station.php /CONTRIBUTE.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contribution to this project is highly encouraged! GOSINT uses the BSD license. To contribute to this project, you must certify that you have the rights to license your contribution for use in GOSINT under the BSD license and that it is not subject to any other licenses. 4 | 5 | To help ensure that these criteria are met, GOSINT requires that you follow the Developer Certificate of Origin (DCO) process. The DCO is an attestation attached to each contribution made by every developer, which you can find below or at http://developercertificate.org/. In the commit message for each commit in the pull request, the developer simply adds a sign-off statement agreeing to the DCO, e.g., “Signed-off-by: Andrew Wiggin " with the DCO text manually added to your commit body. 6 | 7 | ``` 8 | Developer's Certificate of Origin 1.1 9 | 10 | By making a contribution to this project, I certify that: 11 | 12 | (a) The contribution was created in whole or in part by me and I 13 | have the right to submit it under the open source license 14 | indicated in the file; or 15 | 16 | (b) The contribution is based upon previous work that, to the 17 | best of my knowledge, is covered under an appropriate open 18 | source license and I have the right under that license to 19 | submit that work with modifications, whether created in whole 20 | or in part by me, under the same open source license (unless 21 | I am permitted to submit under a different license), as 22 | Indicated in the file; or 23 | 24 | (c) The contribution was provided directly to me by some other 25 | person who certified (a), (b) or (c) and I have not modified 26 | it. 27 | 28 | (d) I understand and agree that this project and the contribution 29 | are public and that a record of the contribution (including 30 | all personal information I submit with it, including my 31 | sign-off) is maintained indefinitely and may be redistributed 32 | consistent with this project or the open source license(s) 33 | involved. 34 | 35 | ``` 36 | 37 | Fork and clone the GOSINT repo, make your changes, and submit the fork and a [pull request][pr]. 38 | 39 | [pr]: https://github.com/ciscocsirt/gosint/compare/ 40 | 41 | Once a pull request is received, we will review the contribution and make our best effort to promptly add it in or reach out to discuss it more. 42 | 43 | Thanks, 44 | 45 | The GOSINT Team 46 | -------------------------------------------------------------------------------- /DEPENDENCIES.txt: -------------------------------------------------------------------------------- 1 | What: mgo 2 | Source URL: https://github.com/go-mgo/mgo 3 | Copyright: Gustavo Niemeyer 4 | License: BSD 2-clause 5 | License text: https://github.com/go-mgo/mgo/blob/v2-unstable/LICENSE 6 | 7 | What: cron 8 | Source URL: https://github.com/robfig/cron 9 | Copyright: Rob Figueiredo 10 | License: MIT 11 | License text: https://github.com/robfig/cron/blob/v2/LICENSE 12 | 13 | What: Gorilla Mux 14 | Source URL: https://github.com/gorilla/mux 15 | Copyright: Rodrigo Moraes 16 | License: BSD 3-clause 17 | License text: https://github.com/gorilla/mux/blob/master/LICENSE 18 | 19 | What: Go Twitter 20 | Source URL: https://github.com/dghubble/go-twitter 21 | Copyright: Dalton Hubble 22 | License: MIT 23 | License text: https://github.com/dghubble/go-twitter/blob/master/LICENSE 24 | 25 | What: oauth1 26 | Source URL: https://github.com/dghubble/oauth1 27 | Copyright: Dalton Hubble 28 | License: MIT 29 | License text: See https://github.com/dghubble/oauth1/blob/master/LICENSE 30 | 31 | What: xurls 32 | Source URL: https://github.com/mvdan/xurls 33 | Copyright: Daniel Martí 34 | License: BSD 3-clause 35 | License text: https://github.com/mvdan/xurls/blob/master/LICENSE 36 | 37 | What: gorequest 38 | Source URL: https://github.com/parnurzeal/gorequest 39 | Copyright: Theeraphol Wattanavekin 40 | License: MIT 41 | License text: https://github.com/parnurzeal/gorequest/blob/develop/LICENSE 42 | 43 | What: xid 44 | Source URL: https://github.com/rs/xid 45 | Copyright: Olivier Poitrey 46 | License: MIT 47 | License text: https://github.com/rs/xid/blob/master/LICENSE 48 | 49 | What: ipisp 50 | Source URL: https://github.com/ammario/ipisp 51 | Copyright: Ammar Bandukwala 52 | License: MIT 53 | License text: https://github.com/ammario/ipisp/blob/master/LICENSE 54 | 55 | What: Bootstrap 56 | Source URL: http://startbootstrap.com/ 57 | Copyright: Blackrock Digital LLC 58 | License: MIT 59 | License Text: https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE 60 | 61 | What: jQuery 62 | Source URL: https://github.com/jquery/jquery 63 | Copyright: JS Foundation and other contributors 64 | License: MIT 65 | License Text: https://github.com/jquery/jquery/blob/master/LICENSE.txt 66 | 67 | What: Bootstrap-Tokenfield 68 | Source URL: http://github.com/sliptree/bootstrap-tokenfield 69 | Copyright: Sliptree 70 | License: MIT 71 | License Text: https://github.com/sliptree/bootstrap-tokenfield/blob/master/LICENSE.md 72 | 73 | What: #Animate.css 74 | Source URL: https://github.com/daneden/animate.css 75 | Copyright: Daniel Eden 76 | License: MIT 77 | License Text: https://github.com/daneden/animate.css/blob/master/LICENSE 78 | 79 | What: DataTables 80 | Source URL: https://datatables.net/ 81 | Copyright: SpryMedia Ltd. 82 | License: MIT 83 | License Text: http://datatables.net/license/mit 84 | 85 | What: CellEdit for DataTables 86 | Source URL: https://github.com/ejbeaty/CellEdit 87 | Copyright: Elliott Beaty 88 | License: MIT 89 | License Text: http://datatables.net/license/mit 90 | 91 | What: MomentJS 92 | Source URL: https://github.com/moment/moment/ 93 | Copyright: JS Foundation and other contributors 94 | License: MIT 95 | License Text: https://github.com/moment/moment/blob/develop/LICENSE 96 | 97 | What: jQuery Modal 98 | Source URL: http://github.com/kylefox/jquery-modal 99 | Copyright: Kyle Fox 100 | License: MIT 101 | License Text: https://github.com/kylefox/jquery-modal/blob/master/LICENSE 102 | 103 | What: SpinKit 104 | Source URL: http://github.com/tobiasahlin/SpinKit 105 | Copyright: Tobias Ahlin 106 | License: MIT 107 | License Text: https://github.com/tobiasahlin/SpinKit/blob/master/LICENSE 108 | 109 | What: d3pie 110 | Source URL: https://github.com/benkeen/d3pie 111 | Copyright: Benjamin Keen 112 | License: MIT 113 | License Text: https://github.com/benkeen/d3pie/blob/master/LICENSE 114 | 115 | What: FileSaver.js 116 | Source URL: https://github.com/eligrey/FileSaver.js/ 117 | Copyright: Eli Grey 118 | License: MIT 119 | License Text: https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md 120 | 121 | What: Dragula 122 | Source URL: https://github.com/bevacqua/dragula 123 | Copyright: Nicolas Bevacqua 124 | License: MIT 125 | License Text: https://github.com/bevacqua/dragula/blob/master/license 126 | -------------------------------------------------------------------------------- /Godeps/Godeps.json: -------------------------------------------------------------------------------- 1 | { 2 | "ImportPath": "gosint", 3 | "GoVersion": "go1.6", 4 | "GodepVersion": "v79", 5 | "Deps": [ 6 | { 7 | "ImportPath": "github.com/ammario/ipisp", 8 | "Rev": "c3859dc60982dfc70622c3ebc4ca626f810ec1cd" 9 | }, 10 | { 11 | "ImportPath": "github.com/cenkalti/backoff", 12 | "Comment": "v1.0.0-14-g8edc80b", 13 | "Rev": "8edc80b07f38c27352fb186d971c628a6c32552b" 14 | }, 15 | { 16 | "ImportPath": "github.com/dghubble/go-twitter/twitter", 17 | "Rev": "536f41ba9ebcee721411517767a6f56b54b4ab65" 18 | }, 19 | { 20 | "ImportPath": "github.com/dghubble/oauth1", 21 | "Comment": "v0.4.0-2-gd9f4856", 22 | "Rev": "d9f485600d309576dfa9764424f537e1f254d9a1" 23 | }, 24 | { 25 | "ImportPath": "github.com/dghubble/sling", 26 | "Comment": "v1.0-23-g52e88a7", 27 | "Rev": "52e88a7b75a5db3b49f8911f16d49d9b7b67adc5" 28 | }, 29 | { 30 | "ImportPath": "github.com/google/go-querystring/query", 31 | "Rev": "9235644dd9e52eeae6fa48efd539fdc351a0af53" 32 | }, 33 | { 34 | "ImportPath": "github.com/gorilla/context", 35 | "Comment": "v1.1-7-g08b5f42", 36 | "Rev": "08b5f424b9271eedf6f9f0ce86cb9396ed337a42" 37 | }, 38 | { 39 | "ImportPath": "github.com/gorilla/mux", 40 | "Comment": "v1.1-21-gcf79e51", 41 | "Rev": "cf79e51a62d8219d52060dfc1b4e810414ba2d15" 42 | }, 43 | { 44 | "ImportPath": "github.com/johngb/langreg", 45 | "Rev": "5c6abc6d19d2a39ff139e0b234177b0508d69ea4" 46 | }, 47 | { 48 | "ImportPath": "github.com/moul/http2curl", 49 | "Rev": "b1479103caacaa39319f75e7f57fc545287fca0d" 50 | }, 51 | { 52 | "ImportPath": "github.com/mvdan/xurls", 53 | "Comment": "v0.9.0-6-g5a3dc90", 54 | "Rev": "5a3dc90eb5681fc090a854cdb1e4cb4f4f01b278" 55 | }, 56 | { 57 | "ImportPath": "github.com/parnurzeal/gorequest", 58 | "Comment": "v0.2.13-46-ge213a02", 59 | "Rev": "e213a02fb0082d41e66996deeaab5ae96039d913" 60 | }, 61 | { 62 | "ImportPath": "github.com/rs/xid", 63 | "Rev": "057f3c928c207d1e7e318929eeac93bb46e319e3" 64 | }, 65 | { 66 | "ImportPath": "golang.org/x/net/context", 67 | "Rev": "07b51741c1d6423d4a6abab1c49940ec09cb1aaf" 68 | }, 69 | { 70 | "ImportPath": "golang.org/x/net/publicsuffix", 71 | "Rev": "07b51741c1d6423d4a6abab1c49940ec09cb1aaf" 72 | }, 73 | { 74 | "ImportPath": "gopkg.in/mgo.v2", 75 | "Comment": "r2016.08.01-5-g3f83fa5", 76 | "Rev": "3f83fa5005286a7fe593b055f0d7771a7dce4655" 77 | }, 78 | { 79 | "ImportPath": "gopkg.in/mgo.v2/bson", 80 | "Comment": "r2016.08.01-5-g3f83fa5", 81 | "Rev": "3f83fa5005286a7fe593b055f0d7771a7dce4655" 82 | }, 83 | { 84 | "ImportPath": "gopkg.in/mgo.v2/internal/json", 85 | "Comment": "r2016.08.01-5-g3f83fa5", 86 | "Rev": "3f83fa5005286a7fe593b055f0d7771a7dce4655" 87 | }, 88 | { 89 | "ImportPath": "gopkg.in/mgo.v2/internal/sasl", 90 | "Comment": "r2016.08.01-5-g3f83fa5", 91 | "Rev": "3f83fa5005286a7fe593b055f0d7771a7dce4655" 92 | }, 93 | { 94 | "ImportPath": "gopkg.in/mgo.v2/internal/scram", 95 | "Comment": "r2016.08.01-5-g3f83fa5", 96 | "Rev": "3f83fa5005286a7fe593b055f0d7771a7dce4655" 97 | }, 98 | { 99 | "ImportPath": "gopkg.in/robfig/cron.v2", 100 | "Comment": "v1-11-gbe2e0b0", 101 | "Rev": "be2e0b0deed5a68ffee390b4583a13aff8321535" 102 | }, 103 | { 104 | "ImportPath": "github.com/pkg/errors", 105 | "Comment": "v0.8.0-5-gc605e28", 106 | "Rev": "c605e284fe17294bda444b34710735b29d1a9d90" 107 | } 108 | ] 109 | } 110 | -------------------------------------------------------------------------------- /Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, Cisco Systems, Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, 4 | are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | 2. 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 | 3. Neither the name of Cisco Systems holder nor the names of its contributors 14 | may be used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GOSINT - Open Source Threat Intelligence Gathering and Processing Framework 2 | 3 | The GOSINT framework is a project used for collecting, processing, and exporting high quality indicators of compromise (IOCs). GOSINT 4 | allows a security analyst to collect and standardize structured and unstructured threat intelligence. Applying threat intelligence to security operations enriches alert data with additional confidence, context, and co-occurrence. This means that you apply research 5 | from third parties to security event data to identify similar, or identical, indicators of malicious behavior. The framework is written in Go with a JavaScript frontend. 6 | 7 | ![Alt Text](https://github.com/ciscocsirt/GOSINT/blob/master/gosint.gif) 8 | 9 | ---------------- 10 | ## Installation 11 | 12 | Please find the installation procedure at http://gosint.readthedocs.io/en/latest/installation.html 13 | 14 | There are three ways to get up and running: 15 | 16 | 1. [Bash install script](http://gosint.readthedocs.io/en/latest/installation.html#bash-install) 17 | 2. [Docker](http://gosint.readthedocs.io/en/latest/installation.html#docker) 18 | 3. [Manual installation](http://gosint.readthedocs.io/en/latest/installation.html#manual-install) 19 | 20 | ---------------- 21 | 22 | ## Updates 23 | 24 | Updating is simple and encouraged as bugs are reported and fixed or new features are added. To update your instance of GOSINT, pull the latest version of GOSINT from the repository and re-run the build command to compile the updated binary. 25 | 26 | ``` 27 | godep go build -o gosint 28 | ``` 29 | 30 | ---------------- 31 | 32 | ## Configuration 33 | 34 | GOSINT needs some quick initial configuration to start making use of the framework features. All the settings you will need to specify can be found under the "Settings" tab. 35 | 36 | Please find the configuration procedure at http://gosint.readthedocs.io/en/latest/configuration.html 37 | 38 | ---------------- 39 | 40 | ## Use 41 | 42 | Please find the instructions for use at http://gosint.readthedocs.io/en/latest/use.html 43 | -------------------------------------------------------------------------------- /bash-install/1-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 4 | echo "~~~ GOSINT Dependencies Installer ~~~" 5 | echo 6 | 7 | # Root privileges required for installation 8 | echo "Checking for root..." 9 | if [[ $EUID -ne 0 ]]; then 10 | echo "This script must be run as root." 11 | echo "Exiting..." 12 | exit 1 13 | else 14 | echo "Root confirmed!" 15 | fi 16 | 17 | echo 18 | echo "Welcome to the GOSINT dependencies installer. I will do my best to get GOSINT depdencies installed on this machine." 19 | 20 | echo 21 | echo "Step 1) Installing MongoDB, PHP, NGINX and Git" 22 | echo 23 | 24 | # User confirmation 25 | while true; do 26 | read -p "Enter Y to continue or N to exit. " yn 27 | case $yn in 28 | [Yy]* ) break;; 29 | [Nn]* ) echo "Exiting..."; echo; exit 1;; 30 | * ) echo "Please answer yes or no.";; 31 | esac 32 | done 33 | 34 | # Get $VERSION_ID 35 | . /etc/os-release 36 | 37 | versionCheck="16.04" 38 | 39 | # check if Ubuntu version is above 16.04, if so then we can install php7 40 | # if not then install php5 41 | if awk "BEGIN { print (${VERSION_ID} >= ${versionCheck}) ? \"1\" : \"0\" }" | grep -q "1"; then 42 | # version is above 16.04, install php7 43 | sudo apt-get -y install mongodb php7.0-fpm nginx git 44 | sudo truncate -s 0 /etc/nginx/sites-available/default 45 | sudo cat nginx-php7.conf > /etc/nginx/sites-available/default 46 | else 47 | # version is below 16.04, install php5 48 | sudo apt-get -y install mongodb php5-fpm nginx git 49 | sudo truncate -s 0 /etc/nginx/sites-available/default 50 | sudo cat nginx-php5.conf > /etc/nginx/sites-available/default 51 | fi 52 | 53 | # Restart nginx to load new configuration 54 | echo "Restarting nginx..." 55 | sudo service nginx restart 56 | 57 | echo 58 | echo "Necessary dependencies installed!" 59 | echo 60 | 61 | echo "Step 2) Creating a 'gosint' user with minimal privileges." 62 | echo 63 | echo "This user will run the backend binary which is responsible for pulling indicators and exposing an API for the frontend to use." 64 | echo 65 | 66 | # User confirmation 67 | while true; do 68 | read -p "Enter Y to continue or N to exit. " yn 69 | case $yn in 70 | [Yy]* ) break;; 71 | [Nn]* ) echo "Exiting..."; echo; exit 1;; 72 | * ) echo "Please answer yes or no.";; 73 | esac 74 | done 75 | 76 | # Add new user gosint 77 | sudo useradd -m gosint 78 | 79 | echo 80 | echo "gosint user added!" 81 | echo 82 | echo "Now switching to second half of installation." 83 | echo 84 | 85 | # Make 2-install script executable and copy to user gosint's home directory 86 | # Then switch to gosint user and execute script 87 | sudo chmod +x 2-install.sh 88 | cp 2-install.sh /home/gosint/ 89 | sudo -i -u gosint bash 2-install.sh 90 | -------------------------------------------------------------------------------- /bash-install/2-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script must be run as user gosint 4 | if [ "$(whoami)" != "gosint" ]; then 5 | echo "Script must be run as user: gosint" 6 | exit -1 7 | fi 8 | 9 | # Change to home directory of gosint user 10 | cd /home/gosint 11 | echo "Changed directory to gosint user home directory." 12 | 13 | echo "Step 3) Creating new directory, downloading GO package, and setting up the environment." 14 | echo 15 | 16 | # User confirmation 17 | while true; do 18 | read -p "Enter Y to continue or N to exit. " yn 19 | case $yn in 20 | [Yy]* ) break;; 21 | [Nn]* ) echo "Exiting..."; echo; exit 1;; 22 | * ) echo "Please answer yes or no.";; 23 | esac 24 | done 25 | 26 | # Check if system is 32- or 64- bit and download corresponding Go version 27 | MACHINE_TYPE=`uname -m` 28 | if [ ${MACHINE_TYPE} == 'x86_64' ]; then 29 | echo 30 | echo "64-bit machine detected." 31 | cd ~ 32 | wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz 33 | echo 34 | echo "Extracting archive..." 35 | tar zxvf go1.8.linux-amd64.tar.gz 36 | else 37 | echo 38 | echo "32-bit machine detected." 39 | cd ~ 40 | wget https://storage.googleapis.com/golang/go1.8.linux-386.tar.gz 41 | echo 42 | echo "Extracting archive..." 43 | echo 44 | tar zxvf go1.8.linux-386.tar.gz 45 | fi 46 | 47 | echo "Go installed. Creating project workspace..." 48 | mkdir ~/projects 49 | echo 50 | 51 | # Set up environment variables 52 | echo "Setting up environment..." 53 | export GOROOT=$HOME/go 54 | export PATH=$PATH:$GOROOT/bin 55 | export GOPATH=$HOME/projects 56 | export GOBIN=$GOPATH/bin 57 | export PATH=$GOPATH:$GOBIN:$PATH 58 | echo 59 | 60 | # Create, compile and run a Hello World program to ensure everything works 61 | echo "I will now run a test Hello World program with Go to ensure things are OK..." 62 | echo -e "package main\nimport \"fmt\"\nfunc main() {\n\nfmt.Printf(\"Hello world\")\n}" > helloworld.go 63 | 64 | go run helloworld.go | grep 'Hello world' &> /dev/null 65 | if [ $? == 0 ]; then 66 | echo "Hello world" 67 | echo "Go environment set up!" 68 | echo 69 | else 70 | echo "Some error encountered..." 71 | exit 1 72 | fi 73 | 74 | echo "Step 4) Installing godep vendor management, cloning, GOSINT repository from Github, and testing gosint binary." 75 | 76 | # User confirmation 77 | while true; do 78 | read -p "Enter Y to continue or N to exit. " yn 79 | case $yn in 80 | [Yy]* ) break;; 81 | [Nn]* ) echo "Exiting..."; echo; exit 1;; 82 | * ) echo "Please answer yes or no.";; 83 | esac 84 | done 85 | 86 | echo 87 | echo "Downloading godep vendor management..." 88 | go get github.com/tools/godep 89 | 90 | echo "Installing godep..." 91 | go install github.com/tools/godep 92 | 93 | # Clone Github repo 94 | echo "Downloading Github repository..." 95 | cd ~/projects/src 96 | git clone https://github.com/ciscocsirt/GOSINT 97 | cd GOSINT 98 | 99 | # Compile GOSINT binary 100 | echo "Compiling GOSINT..." 101 | godep go build -o gosint 102 | chmod +x gosint 103 | 104 | echo 105 | echo "GOSINT successfully compiled!" 106 | echo 107 | echo "We can now do a test run of GOSINT. If everything went well, upon running the GOSINT binary, navigate to http://localhost/ in your browser to load the GOSINT interface." 108 | 109 | # User confirmation 110 | while true; do 111 | read -p "Enter Y to continue or N to exit. " yn 112 | case $yn in 113 | [Yy]* ) break;; 114 | [Nn]* ) echo "Exiting..."; echo; exit 1;; 115 | * ) echo "Please answer yes or no.";; 116 | esac 117 | done 118 | 119 | # Execute gosint binary 120 | ./gosint 121 | 122 | # Exit from the script with success (0) 123 | exit 0 124 | -------------------------------------------------------------------------------- /bash-install/nginx-php5.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | root /home/gosint/projects/src/GOSINT/website; 5 | index index.php index.html index.htm; 6 | try_files $uri $uri/ @apachesite; 7 | 8 | server_name someserver.yourcompany.com; 9 | 10 | gzip on; 11 | gzip_proxied any; 12 | gzip_types 13 | text/css 14 | text/javascript 15 | text/xml 16 | text/plain 17 | application/javascript 18 | application/x-javascript 19 | application/json; 20 | 21 | #location / { 22 | # try_files $uri $uri/ =404; 23 | #} 24 | 25 | error_page 404 /404.html; 26 | error_page 500 502 503 504 /50x.html; 27 | location = /50x.html { 28 | root /usr/share/nginx/html; 29 | } 30 | 31 | location @apachesite { 32 | 33 | proxy_pass http://localhost:8000; 34 | } 35 | 36 | location ~ \.php$ { 37 | try_files $uri =404; 38 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 39 | fastcgi_pass unix:/run/php5-fpm.sock; 40 | fastcgi_index index.php; 41 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 42 | include fastcgi_params; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bash-install/nginx-php7.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | root /home/gosint/projects/src/GOSINT/website; 5 | index index.php index.html index.htm; 6 | try_files $uri $uri/ @apachesite; 7 | 8 | server_name someserver.yourcompany.com; 9 | 10 | gzip on; 11 | gzip_proxied any; 12 | gzip_types 13 | text/css 14 | text/javascript 15 | text/xml 16 | text/plain 17 | application/javascript 18 | application/x-javascript 19 | application/json; 20 | 21 | #location / { 22 | # try_files $uri $uri/ =404; 23 | #} 24 | 25 | error_page 404 /404.html; 26 | error_page 500 502 503 504 /50x.html; 27 | location = /50x.html { 28 | root /usr/share/nginx/html; 29 | } 30 | 31 | location @apachesite { 32 | 33 | proxy_pass http://localhost:8000; 34 | } 35 | 36 | location ~ \.php$ { 37 | try_files $uri =404; 38 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 39 | fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; 40 | fastcgi_index index.php; 41 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 42 | include fastcgi_params; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /database.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net" 6 | "strings" 7 | "time" 8 | 9 | "gopkg.in/mgo.v2/bson" 10 | 11 | "github.com/ammario/ipisp" 12 | ) 13 | 14 | // InsertRaw is used for inserting new indicators in the pre-processing MongoDB collection. 15 | func InsertRaw() { 16 | 17 | for { 18 | select { 19 | case v := <-InsertionQueue: 20 | 21 | InsertDatabase(v) 22 | } 23 | } 24 | } 25 | 26 | 27 | func InsertDatabase(v RawIndicators) { 28 | 29 | 30 | sessionClone := Sessions.Clone() 31 | defer sessionClone.Close() 32 | 33 | //Set timeout high to work with the growth of the historic collection. 34 | sessionClone.SetSocketTimeout(1 * time.Hour) 35 | 36 | h := sessionClone.DB("test").C("historic") 37 | count, err := h.Find(bson.M{"indicator": v.Indicator}).Count() 38 | if err != nil { 39 | log.Println(err) 40 | FatalError(err) 41 | } 42 | // If indicator does exist in historic collection, skip inserting in DB. 43 | if count > 0 { 44 | //log.Printf("Indicator %v has already been seen.\n", v.Indicator) 45 | return 46 | } 47 | 48 | // Check to see if domain matches Alexa domain or contains invalid characters. 49 | switch v.Ind_type { 50 | case "domain": 51 | domain := v.Indicator 52 | for _, top := range Config.AlexaDomains { 53 | if strings.EqualFold(domain, top) { 54 | log.Printf("Indicator %v found in Alexa top 10,000 domains", domain) 55 | return 56 | } else if strings.ContainsAny(domain, "',`()*^&%$#@!") { 57 | log.Printf("Indicator %v contains invalid characters, dropping indicator.\n", domain) 58 | return 59 | } else { 60 | continue 61 | } 62 | } 63 | // Check whitelist domains against URL and for invalid characters. 64 | case "url": 65 | url := v.Indicator 66 | for _, test := range Config.WhiteListDomains { 67 | if strings.Contains(url, test+"/") { 68 | log.Printf("Indicator %v found in Alexa top 10,000 domains", url) 69 | return 70 | } else if strings.ContainsAny(url, "',`") { 71 | log.Println("Indicator %v contains invalid characters, dropping indicator.", url) 72 | return 73 | } else { 74 | continue 75 | } 76 | } 77 | // Attempt to append some extra ASN and ISP information for the IP to the context. 78 | case "ip": 79 | ip := &v.Indicator 80 | context := &v.Context 81 | client, err := ipisp.NewDNSClient() 82 | 83 | if err != nil { 84 | log.Println("Error creating IP reverse lookup client: %v", err) 85 | } 86 | 87 | resp, err := client.LookupIP(net.ParseIP(*ip)) 88 | 89 | if err != nil { 90 | log.Println("Error doing reverse lookup on %v: %v", *ip, err) 91 | return 92 | } 93 | 94 | *context = *context + "| ASN: " + resp.ASN.String() + " ISP: " + resp.Name.Raw 95 | 96 | // Check the IP against the ISP whitelist so you can drop IPs from ISPs that are known good. 97 | for _, whitelist := range Config.WhitelistISP { 98 | whitelistisp := strings.ToLower(whitelist) 99 | isp := strings.ToLower(resp.Name.Raw) 100 | if strings.Contains(isp, whitelistisp) { 101 | log.Printf("Whitelisted ISP found, ignorring %v\n", *ip) 102 | return 103 | } 104 | } 105 | 106 | default: 107 | return 108 | } 109 | 110 | // Insert raw indicator document into historic. 111 | err = h.Insert(v) 112 | if err != nil { 113 | log.Println(err) 114 | } 115 | 116 | c := sessionClone.DB("test").C("pre_processing") 117 | 118 | // Insert raw indicator document into pre-processing. 119 | err = c.Insert(v) 120 | if err != nil { 121 | log.Println(err) 122 | } 123 | sessionClone.Refresh() 124 | time.Sleep(3) 125 | } 126 | -------------------------------------------------------------------------------- /docs/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/docs/api.png -------------------------------------------------------------------------------- /docs/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/docs/arrow.png -------------------------------------------------------------------------------- /docs/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/docs/bullet.png -------------------------------------------------------------------------------- /docs/gosint.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/docs/gosint.gif -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to GOSINT's documentation! 2 | ================================== 3 | 4 | The GOSINT framework is a project used for collecting, processing, and exporting high quality indicators of compromise (IOCs). 5 | 6 | GOSINT allows a security analyst to collect and standardize structured and unstructured threat intelligence. 7 | 8 | Applying threat intelligence to security operations enriches alert data with additional confidence, context, and co-occurrence. This means that you apply research from third parties to security event data to identify similar, or identical, indicators of malicious behavior. The framework is written in Go with a JavaScript frontend. 9 | 10 | |gosint-gif| 11 | 12 | Navigate to a section to begin traversing the documentation. 13 | 14 | .. toctree:: 15 | :maxdepth: 3 16 | 17 | installation 18 | configuration 19 | use 20 | 21 | .. |gosint-gif| image:: gosint.gif 22 | :height: 248 23 | :width: 442 24 | -------------------------------------------------------------------------------- /docs/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/docs/x.png -------------------------------------------------------------------------------- /gosint.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/gosint.gif -------------------------------------------------------------------------------- /logo.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | //PrintLogo is a simple function for printing the framework name called upon start. 8 | func PrintLogo() { 9 | fmt.Print(` 10 | _____ _______ _____ _____ _____ _____ 11 | /\ \ /::\ \ /\ \ /\ \ /\ \ /\ \ 12 | /::\ \ /::::\ \ /::\ \ /::\ \ /::\____\ /::\ \ 13 | /::::\ \ /::::::\ \ /::::\ \ \:::\ \ /::::| | \:::\ \ 14 | /::::::\ \ /::::::::\ \ /::::::\ \ \:::\ \ /:::::| | \:::\ \ 15 | /:::/\:::\ \ /:::/~~\:::\ \ /:::/\:::\ \ \:::\ \ /::::::| | \:::\ \ 16 | /:::/ \:::\ \ /:::/ \:::\ \ /:::/__\:::\ \ \:::\ \ /:::/|::| | \:::\ \ 17 | /:::/ \:::\ \ /:::/ / \:::\ \ \:::\ \:::\ \ /::::\ \ /:::/ |::| | /::::\ \ 18 | /:::/ / \:::\ \ /:::/____/ \:::\____\ ___\:::\ \:::\ \ ____ /::::::\ \ /:::/ |::| | _____ /::::::\ \ 19 | /:::/ / \:::\ ___\|:::| | |:::| |/\ \:::\ \:::\ \ /\ \ /:::/\:::\ \ /:::/ |::| |/\ \ /:::/\:::\ \ 20 | /:::/____/ ___\:::| |:::|____| |:::| /::\ \:::\ \:::\____/::\ \/:::/ \:::\____/:: / |::| /::\____\/:::/ \:::\____\ 21 | \:::\ \ /\ /:::|____|\:::\ \ /:::/ /\:::\ \:::\ \::/ \:::\ /:::/ \::/ \::/ /|::| /:::/ /:::/ \::/ / 22 | \:::\ /::\ \::/ / \:::\ \ /:::/ / \:::\ \:::\ \/____/ \:::\/:::/ / \/____/ \/____/ |::| /:::/ /:::/ / \/____/ 23 | \:::\ \:::\ \/____/ \:::\ /:::/ / \:::\ \:::\ \ \::::::/ / |::|/:::/ /:::/ / 24 | \:::\ \:::\____\ \:::\__/:::/ / \:::\ \:::\____\ \::::/____/ |::::::/ /:::/ / 25 | \:::\ /:::/ / \::::::::/ / \:::\ /:::/ / \:::\ \ |:::::/ /\::/ / 26 | \:::\/:::/ / \::::::/ / \:::\/:::/ / \:::\ \ |::::/ / \/____/ 27 | \::::::/ / \::::/ / \::::::/ / \:::\ \ /:::/ / 28 | \::::/ / \::/____/ \::::/ / \:::\____\ /:::/ / 29 | \::/____/ ~~ \::/ / \::/ / \::/ / 30 | \/____/ \/____/ \/____/ 31 | 32 | `) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/ammario/ipisp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Ammar Bandukwala 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 13 | all 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 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/ammario/ipisp/README.md: -------------------------------------------------------------------------------- 1 | # IPISP 2 | 3 | IPISP provides a Go client for [Team Cymru's](http://www.team-cymru.org/IP-ASN-mapping.html) ASN resolution service. 4 | 5 | Features 6 | - Programmatically resolve IP addresses or ASNs to network information. 7 | - Allows bulk conversion. 8 | - DNS and Netcat/Whois client. 9 | - Thread-safe 10 | 11 | 12 | [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/ammario/ipisp) 13 | 14 | ## Example 15 | 16 | A more thorough example is in the examples/ folder. 17 | 18 | ```go 19 | client, := ipisp.NewDnsClient() 20 | 21 | resp, _ := client.LookupIP(net.ParseIP("4.2.2.2")) 22 | 23 | fmt.Printf("IP: %v\n", resp.IP) 24 | fmt.Printf("ASN: %v\n", resp.ASN) 25 | fmt.Printf("Range: %v\n", resp.Range) 26 | fmt.Printf("Country: %v\n", resp.Country) 27 | fmt.Printf("Registry: %v\n", resp.Registry) 28 | fmt.Printf("ISP: %v\n", resp.Name) 29 | ``` -------------------------------------------------------------------------------- /vendor/github.com/ammario/ipisp/asn.go: -------------------------------------------------------------------------------- 1 | package ipisp 2 | 3 | import ( 4 | "strconv" 5 | "strings" 6 | 7 | "github.com/pkg/errors" 8 | ) 9 | 10 | //ASN contains an Autonomous Systems Number 11 | type ASN int 12 | 13 | //ParseASN parses a string like AS2341 into an ASN 14 | func ParseASN(asn string) (ASN, error) { 15 | //Make case insensitive 16 | asn = strings.ToUpper(asn) 17 | if len(asn) > 2 { 18 | nn, err := strconv.Atoi(asn[2:]) 19 | return ASN(nn), errors.Wrap(err, "failed to conv into to string") 20 | } 21 | return 0, errors.Errorf("invalid asn") 22 | } 23 | 24 | //String implements fmt.Stringer 25 | func (a ASN) String() string { 26 | return "AS" + strconv.Itoa(int(a)) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/ammario/ipisp/client.go: -------------------------------------------------------------------------------- 1 | package ipisp 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | //Client is a lookup client 8 | type Client interface { 9 | LookupIPs([]net.IP) ([]Response, error) 10 | LookupIP(net.IP) (*Response, error) 11 | LookupASNs([]ASN) ([]Response, error) 12 | LookupASN(ASN) (*Response, error) 13 | Close() error 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/ammario/ipisp/dns_client.go: -------------------------------------------------------------------------------- 1 | package ipisp 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "strconv" 7 | "strings" 8 | "time" 9 | 10 | "github.com/pkg/errors" 11 | ) 12 | 13 | const hexDigit = "0123456789abcdef" 14 | 15 | type DNSClient struct { 16 | } 17 | 18 | //NewDNSClient returns a dns client 19 | func NewDNSClient() (client *DNSClient, err error) { 20 | return &DNSClient{}, nil 21 | } 22 | 23 | func (c *DNSClient) LookupIPs(ips []net.IP) ([]Response, error) { 24 | ret := make([]Response, len(ips)) 25 | 26 | for _, ip := range ips { 27 | resp, err := c.LookupIP(ip) 28 | if err != nil { 29 | return ret, err 30 | } 31 | ret = append(ret, *resp) 32 | } 33 | return ret, nil 34 | } 35 | 36 | func (c *DNSClient) LookupIP(ip net.IP) (*Response, error) { 37 | lookupName, err := c.getLookupName(ip) 38 | txts, err := net.LookupTXT(lookupName) 39 | if err != nil { 40 | return nil, err 41 | } 42 | 43 | for _, txt := range txts { 44 | values := strings.Split(txt, "|") 45 | if len(values) != 5 { 46 | return nil, fmt.Errorf("Received unrecognized response: %s", txt) 47 | } 48 | for k := range values { 49 | values[k] = strings.TrimSpace(values[k]) 50 | } 51 | 52 | ret := &Response{ 53 | IP: ip, 54 | Registry: strings.ToUpper(values[3]), 55 | } 56 | 57 | var err error 58 | asn, err := strconv.Atoi(values[0]) 59 | if err != nil { 60 | return nil, errors.Wrapf(err, "Could not parse ASN (%s): %s", values[0]) 61 | } 62 | ret.ASN = ASN(asn) 63 | 64 | ret.Country = strings.TrimSpace(values[2]) 65 | 66 | _, ret.Range, err = net.ParseCIDR(values[1]) 67 | if err != nil { 68 | return nil, fmt.Errorf("Could not parse Range (%s): %s", values[1], err) 69 | } 70 | 71 | if values[4] != "" { // There's not always an allocation date available :( 72 | ret.AllocatedAt, err = time.Parse("2006-01-02", values[4]) 73 | if err != nil { 74 | return nil, fmt.Errorf("Could not parse date (%s): %s", values[4], err) 75 | } 76 | } 77 | 78 | asnResponse, err := c.LookupASN(ret.ASN) 79 | if err != nil { 80 | return nil, fmt.Errorf("Could not retrieve ASN (%s): %s", ret.ASN.String(), err.Error()) 81 | } 82 | 83 | ret.Name = asnResponse.Name 84 | 85 | return ret, nil 86 | 87 | } 88 | 89 | return nil, fmt.Errorf("No records found") 90 | } 91 | 92 | func (c *DNSClient) LookupASNs(asns []ASN) ([]Response, error) { 93 | ret := make([]Response, len(asns)) 94 | 95 | for _, asn := range asns { 96 | resp, err := c.LookupASN(asn) 97 | if err != nil { 98 | return ret, err 99 | } 100 | ret = append(ret, *resp) 101 | } 102 | return ret, nil 103 | } 104 | 105 | func (c *DNSClient) LookupASN(asn ASN) (*Response, error) { 106 | txts, err := net.LookupTXT(asn.String() + ".asn.cymru.com") 107 | if err != nil { 108 | return nil, err 109 | } 110 | 111 | for _, txt := range txts { 112 | values := strings.Split(txt, "|") 113 | if len(values) != 5 { 114 | return nil, fmt.Errorf("Received unrecognized response in AS lookup: %s", txt) 115 | } 116 | for k := range values { 117 | values[k] = strings.TrimSpace(values[k]) 118 | } 119 | 120 | resp := &Response{ 121 | ASN: asn, 122 | Registry: strings.ToUpper(values[2]), 123 | Name: ParseName(values[4]), 124 | } 125 | 126 | resp.Country = values[1] 127 | 128 | if values[3] != "" { 129 | resp.AllocatedAt, err = time.Parse("2006-01-02", values[3]) 130 | if err != nil { 131 | return nil, fmt.Errorf("Could not parse date (%s): %s", values[3], err) 132 | } 133 | } 134 | 135 | return resp, nil 136 | } 137 | 138 | return nil, fmt.Errorf("No records found") 139 | } 140 | 141 | func (c *DNSClient) Close() error { 142 | return nil 143 | } 144 | 145 | func (c *DNSClient) getLookupName(ip net.IP) (string, error) { 146 | if p4 := ip.To4(); len(p4) == net.IPv4len { 147 | return fmt.Sprintf("%d.%d.%d.%d.origin.asn.cymru.com", ip[15], ip[14], ip[13], ip[12]), nil 148 | } 149 | 150 | if len(ip) != net.IPv6len { 151 | return "", fmt.Errorf("Could not parse IP. Invalid length (%d)", len(ip)) 152 | } 153 | 154 | sep := []byte(`.`)[0] 155 | b := make([]byte, 0, 64) 156 | for i := 16; i >= 2; i -= 2 { 157 | for j := 0; j <= 3; j++ { 158 | v := ((uint32(ip[i-2]) << 8) | uint32(ip[i-1])) >> uint(j*4) 159 | b = append(b, hexDigit[v&0xf], sep) 160 | } 161 | } 162 | 163 | return fmt.Sprintf("%s.origin6.asn.cymru.com", (b[:63])), nil 164 | } 165 | -------------------------------------------------------------------------------- /vendor/github.com/ammario/ipisp/name.go: -------------------------------------------------------------------------------- 1 | package ipisp 2 | 3 | import "strings" 4 | 5 | //Name contains an IPISP ISP name 6 | type Name struct { 7 | Raw string 8 | Short string 9 | Long string 10 | } 11 | 12 | //ParseName returns a pointer to a new name 13 | func ParseName(raw string) Name { 14 | tokens := strings.Split(raw, "-") 15 | if len(tokens) == 0 { 16 | tokens = []string{raw} 17 | } 18 | if len(tokens) == 1 { 19 | tokens = []string{tokens[0], raw} 20 | } 21 | return Name{ 22 | Raw: strings.TrimSpace(raw), 23 | Short: strings.TrimSpace(tokens[0]), 24 | Long: strings.TrimSpace(tokens[1]), 25 | } 26 | } 27 | 28 | //String returns a human friendly representation of n 29 | func (n Name) String() string { 30 | return n.Long 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/ammario/ipisp/response.go: -------------------------------------------------------------------------------- 1 | package ipisp 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "net" 7 | "time" 8 | ) 9 | 10 | //Response contains a response from Cymru 11 | type Response struct { 12 | IP net.IP 13 | ASN ASN 14 | Name Name 15 | Country string 16 | Registry string 17 | Range *net.IPNet 18 | AllocatedAt time.Time 19 | } 20 | 21 | //String provides an easy to read version of r 22 | func (r *Response) String() string { 23 | buf := &bytes.Buffer{} 24 | buf.WriteRune('\n') 25 | fmt.Fprintf(buf, "IP : %v\n", r.IP) 26 | fmt.Fprintf(buf, "ASN : %v\n", r.ASN) 27 | fmt.Fprintf(buf, "Name : %v\n", r.Name) 28 | fmt.Fprintf(buf, "Country : %v\n", r.Country) 29 | fmt.Fprintf(buf, "Registry: %v\n", r.Registry) 30 | fmt.Fprintf(buf, "Range : %v\n", r.Range) 31 | fmt.Fprintf(buf, "Alloc At: %v\n", r.AllocatedAt) 32 | 33 | return buf.String() 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/backoff/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/backoff/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.3.3 4 | - tip 5 | before_install: 6 | - go get github.com/mattn/goveralls 7 | - go get golang.org/x/tools/cmd/cover 8 | script: 9 | - $HOME/gopath/bin/goveralls -service=travis-ci 10 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/backoff/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Cenk Altı 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 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/backoff/README.md: -------------------------------------------------------------------------------- 1 | # Exponential Backoff [![GoDoc][godoc image]][godoc] [![Build Status][travis image]][travis] [![Coverage Status][coveralls image]][coveralls] 2 | 3 | This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. 4 | 5 | [Exponential backoff][exponential backoff wiki] 6 | is an algorithm that uses feedback to multiplicatively decrease the rate of some process, 7 | in order to gradually find an acceptable rate. 8 | The retries exponentially increase and stop increasing when a certain threshold is met. 9 | 10 | ## Usage 11 | 12 | See https://godoc.org/github.com/cenk/backoff#pkg-examples 13 | 14 | ## Contributing 15 | 16 | * I would like to keep this library as small as possible. 17 | * Please don't send a PR without opening an issue and discussing it first. 18 | * If proposed change is not a common use case, I will probably not accept it. 19 | 20 | [godoc]: https://godoc.org/github.com/cenk/backoff 21 | [godoc image]: https://godoc.org/github.com/cenk/backoff?status.png 22 | [travis]: https://travis-ci.org/cenk/backoff 23 | [travis image]: https://travis-ci.org/cenk/backoff.png?branch=master 24 | [coveralls]: https://coveralls.io/github/cenk/backoff?branch=master 25 | [coveralls image]: https://coveralls.io/repos/github/cenk/backoff/badge.svg?branch=master 26 | 27 | [google-http-java-client]: https://github.com/google/google-http-java-client 28 | [exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff 29 | 30 | [advanced example]: https://godoc.org/github.com/cenk/backoff#example_ 31 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/backoff/backoff.go: -------------------------------------------------------------------------------- 1 | // Package backoff implements backoff algorithms for retrying operations. 2 | // 3 | // Use Retry function for retrying operations that may fail. 4 | // If Retry does not meet your needs, 5 | // copy/paste the function into your project and modify as you wish. 6 | // 7 | // There is also Ticker type similar to time.Ticker. 8 | // You can use it if you need to work with channels. 9 | // 10 | // See Examples section below for usage examples. 11 | package backoff 12 | 13 | import "time" 14 | 15 | // BackOff is a backoff policy for retrying an operation. 16 | type BackOff interface { 17 | // NextBackOff returns the duration to wait before retrying the operation, 18 | // or backoff.Stop to indicate that no more retries should be made. 19 | // 20 | // Example usage: 21 | // 22 | // duration := backoff.NextBackOff(); 23 | // if (duration == backoff.Stop) { 24 | // // Do not retry operation. 25 | // } else { 26 | // // Sleep for duration and retry operation. 27 | // } 28 | // 29 | NextBackOff() time.Duration 30 | 31 | // Reset to initial state. 32 | Reset() 33 | } 34 | 35 | // Stop indicates that no more retries should be made for use in NextBackOff(). 36 | const Stop time.Duration = -1 37 | 38 | // ZeroBackOff is a fixed backoff policy whose backoff time is always zero, 39 | // meaning that the operation is retried immediately without waiting, indefinitely. 40 | type ZeroBackOff struct{} 41 | 42 | func (b *ZeroBackOff) Reset() {} 43 | 44 | func (b *ZeroBackOff) NextBackOff() time.Duration { return 0 } 45 | 46 | // StopBackOff is a fixed backoff policy that always returns backoff.Stop for 47 | // NextBackOff(), meaning that the operation should never be retried. 48 | type StopBackOff struct{} 49 | 50 | func (b *StopBackOff) Reset() {} 51 | 52 | func (b *StopBackOff) NextBackOff() time.Duration { return Stop } 53 | 54 | // ConstantBackOff is a backoff policy that always returns the same backoff delay. 55 | // This is in contrast to an exponential backoff policy, 56 | // which returns a delay that grows longer as you call NextBackOff() over and over again. 57 | type ConstantBackOff struct { 58 | Interval time.Duration 59 | } 60 | 61 | func (b *ConstantBackOff) Reset() {} 62 | func (b *ConstantBackOff) NextBackOff() time.Duration { return b.Interval } 63 | 64 | func NewConstantBackOff(d time.Duration) *ConstantBackOff { 65 | return &ConstantBackOff{Interval: d} 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/backoff/retry.go: -------------------------------------------------------------------------------- 1 | package backoff 2 | 3 | import "time" 4 | 5 | // An Operation is executing by Retry() or RetryNotify(). 6 | // The operation will be retried using a backoff policy if it returns an error. 7 | type Operation func() error 8 | 9 | // Notify is a notify-on-error function. It receives an operation error and 10 | // backoff delay if the operation failed (with an error). 11 | // 12 | // NOTE that if the backoff policy stated to stop retrying, 13 | // the notify function isn't called. 14 | type Notify func(error, time.Duration) 15 | 16 | // Retry the operation o until it does not return error or BackOff stops. 17 | // o is guaranteed to be run at least once. 18 | // It is the caller's responsibility to reset b after Retry returns. 19 | // 20 | // Retry sleeps the goroutine for the duration returned by BackOff after a 21 | // failed operation returns. 22 | func Retry(o Operation, b BackOff) error { return RetryNotify(o, b, nil) } 23 | 24 | // RetryNotify calls notify function with the error and wait duration 25 | // for each failed attempt before sleep. 26 | func RetryNotify(operation Operation, b BackOff, notify Notify) error { 27 | var err error 28 | var next time.Duration 29 | 30 | b.Reset() 31 | for { 32 | if err = operation(); err == nil { 33 | return nil 34 | } 35 | 36 | if next = b.NextBackOff(); next == Stop { 37 | return err 38 | } 39 | 40 | if notify != nil { 41 | notify(err, next) 42 | } 43 | 44 | time.Sleep(next) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/backoff/ticker.go: -------------------------------------------------------------------------------- 1 | package backoff 2 | 3 | import ( 4 | "runtime" 5 | "sync" 6 | "time" 7 | ) 8 | 9 | // Ticker holds a channel that delivers `ticks' of a clock at times reported by a BackOff. 10 | // 11 | // Ticks will continue to arrive when the previous operation is still running, 12 | // so operations that take a while to fail could run in quick succession. 13 | type Ticker struct { 14 | C <-chan time.Time 15 | c chan time.Time 16 | b BackOff 17 | stop chan struct{} 18 | stopOnce sync.Once 19 | } 20 | 21 | // NewTicker returns a new Ticker containing a channel that will send the time at times 22 | // specified by the BackOff argument. Ticker is guaranteed to tick at least once. 23 | // The channel is closed when Stop method is called or BackOff stops. 24 | func NewTicker(b BackOff) *Ticker { 25 | c := make(chan time.Time) 26 | t := &Ticker{ 27 | C: c, 28 | c: c, 29 | b: b, 30 | stop: make(chan struct{}), 31 | } 32 | go t.run() 33 | runtime.SetFinalizer(t, (*Ticker).Stop) 34 | return t 35 | } 36 | 37 | // Stop turns off a ticker. After Stop, no more ticks will be sent. 38 | func (t *Ticker) Stop() { 39 | t.stopOnce.Do(func() { close(t.stop) }) 40 | } 41 | 42 | func (t *Ticker) run() { 43 | c := t.c 44 | defer close(c) 45 | t.b.Reset() 46 | 47 | // Ticker is guaranteed to tick at least once. 48 | afterC := t.send(time.Now()) 49 | 50 | for { 51 | if afterC == nil { 52 | return 53 | } 54 | 55 | select { 56 | case tick := <-afterC: 57 | afterC = t.send(tick) 58 | case <-t.stop: 59 | t.c = nil // Prevent future ticks from being sent to the channel. 60 | return 61 | } 62 | } 63 | } 64 | 65 | func (t *Ticker) send(tick time.Time) <-chan time.Time { 66 | select { 67 | case t.c <- tick: 68 | case <-t.stop: 69 | return nil 70 | } 71 | 72 | next := t.b.NextBackOff() 73 | if next == Stop { 74 | t.Stop() 75 | return nil 76 | } 77 | 78 | return time.After(next) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-querystring/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Google. 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 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - go: 1.3 7 | - go: 1.4 8 | - go: 1.5 9 | - go: 1.6 10 | - go: 1.7 11 | - go: tip 12 | allow_failures: 13 | - go: tip 14 | 15 | script: 16 | - go get -t -v ./... 17 | - diff -u <(echo -n) <(gofmt -d .) 18 | - go vet $(go list ./... | grep -v /vendor/) 19 | - go test -v -race ./... 20 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rodrigo Moraes. 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 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/README.md: -------------------------------------------------------------------------------- 1 | context 2 | ======= 3 | [![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context) 4 | 5 | gorilla/context is a general purpose registry for global request variables. 6 | 7 | > Note: gorilla/context, having been born well before `context.Context` existed, does not play well 8 | > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. 9 | 10 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/context 11 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/context.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Gorilla 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 | package context 6 | 7 | import ( 8 | "net/http" 9 | "sync" 10 | "time" 11 | ) 12 | 13 | var ( 14 | mutex sync.RWMutex 15 | data = make(map[*http.Request]map[interface{}]interface{}) 16 | datat = make(map[*http.Request]int64) 17 | ) 18 | 19 | // Set stores a value for a given key in a given request. 20 | func Set(r *http.Request, key, val interface{}) { 21 | mutex.Lock() 22 | if data[r] == nil { 23 | data[r] = make(map[interface{}]interface{}) 24 | datat[r] = time.Now().Unix() 25 | } 26 | data[r][key] = val 27 | mutex.Unlock() 28 | } 29 | 30 | // Get returns a value stored for a given key in a given request. 31 | func Get(r *http.Request, key interface{}) interface{} { 32 | mutex.RLock() 33 | if ctx := data[r]; ctx != nil { 34 | value := ctx[key] 35 | mutex.RUnlock() 36 | return value 37 | } 38 | mutex.RUnlock() 39 | return nil 40 | } 41 | 42 | // GetOk returns stored value and presence state like multi-value return of map access. 43 | func GetOk(r *http.Request, key interface{}) (interface{}, bool) { 44 | mutex.RLock() 45 | if _, ok := data[r]; ok { 46 | value, ok := data[r][key] 47 | mutex.RUnlock() 48 | return value, ok 49 | } 50 | mutex.RUnlock() 51 | return nil, false 52 | } 53 | 54 | // GetAll returns all stored values for the request as a map. Nil is returned for invalid requests. 55 | func GetAll(r *http.Request) map[interface{}]interface{} { 56 | mutex.RLock() 57 | if context, ok := data[r]; ok { 58 | result := make(map[interface{}]interface{}, len(context)) 59 | for k, v := range context { 60 | result[k] = v 61 | } 62 | mutex.RUnlock() 63 | return result 64 | } 65 | mutex.RUnlock() 66 | return nil 67 | } 68 | 69 | // GetAllOk returns all stored values for the request as a map and a boolean value that indicates if 70 | // the request was registered. 71 | func GetAllOk(r *http.Request) (map[interface{}]interface{}, bool) { 72 | mutex.RLock() 73 | context, ok := data[r] 74 | result := make(map[interface{}]interface{}, len(context)) 75 | for k, v := range context { 76 | result[k] = v 77 | } 78 | mutex.RUnlock() 79 | return result, ok 80 | } 81 | 82 | // Delete removes a value stored for a given key in a given request. 83 | func Delete(r *http.Request, key interface{}) { 84 | mutex.Lock() 85 | if data[r] != nil { 86 | delete(data[r], key) 87 | } 88 | mutex.Unlock() 89 | } 90 | 91 | // Clear removes all values stored for a given request. 92 | // 93 | // This is usually called by a handler wrapper to clean up request 94 | // variables at the end of a request lifetime. See ClearHandler(). 95 | func Clear(r *http.Request) { 96 | mutex.Lock() 97 | clear(r) 98 | mutex.Unlock() 99 | } 100 | 101 | // clear is Clear without the lock. 102 | func clear(r *http.Request) { 103 | delete(data, r) 104 | delete(datat, r) 105 | } 106 | 107 | // Purge removes request data stored for longer than maxAge, in seconds. 108 | // It returns the amount of requests removed. 109 | // 110 | // If maxAge <= 0, all request data is removed. 111 | // 112 | // This is only used for sanity check: in case context cleaning was not 113 | // properly set some request data can be kept forever, consuming an increasing 114 | // amount of memory. In case this is detected, Purge() must be called 115 | // periodically until the problem is fixed. 116 | func Purge(maxAge int) int { 117 | mutex.Lock() 118 | count := 0 119 | if maxAge <= 0 { 120 | count = len(data) 121 | data = make(map[*http.Request]map[interface{}]interface{}) 122 | datat = make(map[*http.Request]int64) 123 | } else { 124 | min := time.Now().Unix() - int64(maxAge) 125 | for r := range data { 126 | if datat[r] < min { 127 | clear(r) 128 | count++ 129 | } 130 | } 131 | } 132 | mutex.Unlock() 133 | return count 134 | } 135 | 136 | // ClearHandler wraps an http.Handler and clears request values at the end 137 | // of a request lifetime. 138 | func ClearHandler(h http.Handler) http.Handler { 139 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 140 | defer Clear(r) 141 | h.ServeHTTP(w, r) 142 | }) 143 | } 144 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Gorilla 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 | /* 6 | Package context stores values shared during a request lifetime. 7 | 8 | Note: gorilla/context, having been born well before `context.Context` existed, 9 | does not play well > with the shallow copying of the request that 10 | [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) 11 | (added to net/http Go 1.7 onwards) performs. You should either use *just* 12 | gorilla/context, or moving forward, the new `http.Request.Context()`. 13 | 14 | For example, a router can set variables extracted from the URL and later 15 | application handlers can access those values, or it can be used to store 16 | sessions values to be saved at the end of a request. There are several 17 | others common uses. 18 | 19 | The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: 20 | 21 | http://groups.google.com/group/golang-nuts/msg/e2d679d303aa5d53 22 | 23 | Here's the basic usage: first define the keys that you will need. The key 24 | type is interface{} so a key can be of any type that supports equality. 25 | Here we define a key using a custom int type to avoid name collisions: 26 | 27 | package foo 28 | 29 | import ( 30 | "github.com/gorilla/context" 31 | ) 32 | 33 | type key int 34 | 35 | const MyKey key = 0 36 | 37 | Then set a variable. Variables are bound to an http.Request object, so you 38 | need a request instance to set a value: 39 | 40 | context.Set(r, MyKey, "bar") 41 | 42 | The application can later access the variable using the same key you provided: 43 | 44 | func MyHandler(w http.ResponseWriter, r *http.Request) { 45 | // val is "bar". 46 | val := context.Get(r, foo.MyKey) 47 | 48 | // returns ("bar", true) 49 | val, ok := context.GetOk(r, foo.MyKey) 50 | // ... 51 | } 52 | 53 | And that's all about the basic usage. We discuss some other ideas below. 54 | 55 | Any type can be stored in the context. To enforce a given type, make the key 56 | private and wrap Get() and Set() to accept and return values of a specific 57 | type: 58 | 59 | type key int 60 | 61 | const mykey key = 0 62 | 63 | // GetMyKey returns a value for this package from the request values. 64 | func GetMyKey(r *http.Request) SomeType { 65 | if rv := context.Get(r, mykey); rv != nil { 66 | return rv.(SomeType) 67 | } 68 | return nil 69 | } 70 | 71 | // SetMyKey sets a value for this package in the request values. 72 | func SetMyKey(r *http.Request, val SomeType) { 73 | context.Set(r, mykey, val) 74 | } 75 | 76 | Variables must be cleared at the end of a request, to remove all values 77 | that were stored. This can be done in an http.Handler, after a request was 78 | served. Just call Clear() passing the request: 79 | 80 | context.Clear(r) 81 | 82 | ...or use ClearHandler(), which conveniently wraps an http.Handler to clear 83 | variables at the end of a request lifetime. 84 | 85 | The Routers from the packages gorilla/mux and gorilla/pat call Clear() 86 | so if you are using either of them you don't need to clear the context manually. 87 | */ 88 | package context 89 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - go: 1.2 7 | - go: 1.3 8 | - go: 1.4 9 | - go: 1.5 10 | - go: 1.6 11 | - go: 1.7 12 | - go: tip 13 | 14 | install: 15 | - # Skip 16 | 17 | script: 18 | - go get -t -v ./... 19 | - diff -u <(echo -n) <(gofmt -d .) 20 | - go tool vet . 21 | - go test -v -race ./... 22 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Rodrigo Moraes. 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 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/context_gorilla.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "net/http" 7 | 8 | "github.com/gorilla/context" 9 | ) 10 | 11 | func contextGet(r *http.Request, key interface{}) interface{} { 12 | return context.Get(r, key) 13 | } 14 | 15 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 16 | if val == nil { 17 | return r 18 | } 19 | 20 | context.Set(r, key, val) 21 | return r 22 | } 23 | 24 | func contextClear(r *http.Request) { 25 | context.Clear(r) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/context_native.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "context" 7 | "net/http" 8 | ) 9 | 10 | func contextGet(r *http.Request, key interface{}) interface{} { 11 | return r.Context().Value(key) 12 | } 13 | 14 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 15 | if val == nil { 16 | return r 17 | } 18 | 19 | return r.WithContext(context.WithValue(r.Context(), key, val)) 20 | } 21 | 22 | func contextClear(r *http.Request) { 23 | return 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/johngb/langreg/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 John Beckett 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 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/johngb/langreg/langreg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 John G. Beckett. All rights reserved. 2 | // Use of this source code is governed by the MIT 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package langreg is a library for validating ISO 639-1 language 6 | // and ISO 1366-1_alpa-2 region codes. 7 | // 8 | // ISO 639-1 language codes are two charcters long and use only lowercase ASCII 9 | // character a-z. E.g.: 10 | // 11 | // "en", "es", "ru" 12 | // 13 | // ISO 1366-1_alpa-2 region codes are two charcters long and use only uppercase 14 | // ASCII character A-Z. E.g.: 15 | // 16 | // "US", "UK", "ZA" 17 | // 18 | // When combined as a composite language and region code, they are concatented 19 | // with an underscore. E.g.: 20 | // 21 | // "en_US", "en_ZA", "fr_FR" 22 | // 23 | // Any codes not meeting these formatting requirement will fail validation. 24 | package langreg 25 | 26 | // IsValidLangRegCode returns true if the string s is a valid ISO 639-1 language 27 | // and ISO1366-1_alpa-2 region code separated by an underscore. E.g. "en_US". 28 | func IsValidLangRegCode(s string) bool { 29 | 30 | // all valid codes are 5 characters long 31 | if len(s) != 5 { 32 | return false 33 | } 34 | 35 | // the middle (third) character must be a '_' char 36 | if s[2] != '_' { 37 | return false 38 | } 39 | 40 | // check the language code, which should be the first two characters in s 41 | if !IsValidLanguageCode(s[:2]) { 42 | return false 43 | } 44 | 45 | // check the region code, which should be the last two characters in s 46 | if !IsValidRegionCode(s[3:]) { 47 | return false 48 | } 49 | return true 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/johngb/langreg/language.go: -------------------------------------------------------------------------------- 1 | //go:generate go run datagen/language/genlang.go 2 | 3 | package langreg 4 | 5 | // IsValidLanguageCode returns true if s is a valid ISO 639-1 language code 6 | func IsValidLanguageCode(s string) bool { 7 | _, _, err := LangCodeInfo(s) 8 | if err != nil { 9 | return false 10 | } 11 | return true 12 | } 13 | 14 | // LangEnglishName returns the English name(s) corresponding to the language code 15 | // s. If there are multiple names, they are separated by a `;`. 16 | func LangEnglishName(s string) (string, error) { 17 | en, _, err := LangCodeInfo(s) 18 | return en, err 19 | } 20 | 21 | // LangNativeName returns the native name(s) corresponding to the language code s 22 | // in the native script(s). If there are multiple names, they are separated 23 | // by a `;`. 24 | func LangNativeName(s string) (string, error) { 25 | _, nat, err := LangCodeInfo(s) 26 | return nat, err 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/johngb/langreg/region.go: -------------------------------------------------------------------------------- 1 | //go:generate go run datagen/region/genreg.go 2 | 3 | package langreg 4 | 5 | // IsValidRegionCode returns true if s is a valid ISO1366-1_alpa-2 region code. 6 | func IsValidRegionCode(s string) bool { 7 | _, err := RegionCodeInfo(s) 8 | if err != nil { 9 | return false 10 | } 11 | return true 12 | } 13 | 14 | // RegionName returns the English name of the ISO1366-1_alpa-2 region code s. 15 | func RegionName(s string) (string, error) { 16 | name, err := RegionCodeInfo(s) 17 | return name, err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/johngb/langreg/wercker.yml: -------------------------------------------------------------------------------- 1 | box: wercker/default -------------------------------------------------------------------------------- /vendor/github.com/moul/http2curl/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/moul/http2curl/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | #- 1.1 5 | - 1.2 6 | - 1.3 7 | - 1.4 8 | - 1.5 9 | - tip 10 | 11 | env: 12 | - GO15VENDOREXPERIMENT=1 13 | 14 | matrix: 15 | allow_failures: 16 | - go: tip 17 | 18 | before_install: 19 | - go get -u github.com/axw/gocov/gocov 20 | - go get -u github.com/mattn/goveralls 21 | - go get golang.org/x/tools/cmd/cover 22 | 23 | script: 24 | - make build 25 | - make test 26 | - make cover 27 | - goveralls -service=travis-ci -v -covermode=count -coverprofile=profile.out 28 | -------------------------------------------------------------------------------- /vendor/github.com/moul/http2curl/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Manfred Touron 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 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/moul/http2curl/Makefile: -------------------------------------------------------------------------------- 1 | # Project-specific variables 2 | CONVEY_PORT ?= 9042 3 | 4 | 5 | # Common variables 6 | SOURCES := $(shell find . -type f -name "*.go") 7 | COMMANDS := $(shell go list ./... | grep -v /vendor/ | grep /cmd/) 8 | PACKAGES := $(shell go list ./... | grep -v /vendor/ | grep -v /cmd/) 9 | GOENV ?= GO15VENDOREXPERIMENT=1 10 | GO ?= $(GOENV) go 11 | GODEP ?= $(GOENV) godep 12 | USER ?= $(shell whoami) 13 | 14 | 15 | all: build 16 | 17 | 18 | .PHONY: build 19 | build: 20 | echo "nothing to do" 21 | 22 | 23 | .PHONY: test 24 | test: 25 | $(GO) get -t . 26 | $(GO) test -v . 27 | 28 | 29 | .PHONY: godep-save 30 | godep-save: 31 | $(GODEP) save $(PACKAGES) $(COMMANDS) 32 | 33 | 34 | .PHONY: re 35 | re: clean all 36 | 37 | 38 | .PHONY: convey 39 | convey: 40 | $(GO) get github.com/smartystreets/goconvey 41 | goconvey -cover -port=$(CONVEY_PORT) -workDir="$(realpath .)" -depth=1 42 | 43 | 44 | .PHONY: cover 45 | cover: profile.out 46 | 47 | 48 | profile.out: $(SOURCES) 49 | rm -f $@ 50 | $(GO) test -covermode=count -coverpkg=. -coverprofile=$@ . 51 | -------------------------------------------------------------------------------- /vendor/github.com/moul/http2curl/README.md: -------------------------------------------------------------------------------- 1 | # http2curl 2 | :triangular_ruler: Convert Golang's http.Request to CURL command line 3 | 4 | [![Build Status](https://travis-ci.org/moul/http2curl.svg?branch=master)](https://travis-ci.org/moul/http2curl) 5 | [![GoDoc](https://godoc.org/github.com/moul/http2curl?status.svg)](https://godoc.org/github.com/moul/http2curl) 6 | [![Coverage Status](https://coveralls.io/repos/moul/http2curl/badge.svg)](https://coveralls.io/github/moul/http2curl) 7 | 8 | To do the reverse, check out [mholt/curl-to-go](https://github.com/mholt/curl-to-go). 9 | 10 | ## Example 11 | 12 | ```go 13 | import "http" 14 | import "github.com/moul/http2curl" 15 | 16 | data := bytes.NewBufferString(`{"hello":"world","answer":42}`) 17 | req, _ := http.NewRequest("PUT", "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu", data) 18 | req.Header.Set("Content-Type", "application/json") 19 | 20 | command, _ := http2curl.GetCurlCommand(req) 21 | fmt.Println(command) 22 | // Output: curl -X PUT -d "{\"hello\":\"world\",\"answer\":42}" -H "Content-Type: application/json" http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu 23 | ``` 24 | 25 | ## Install 26 | 27 | ```php 28 | $ go get github.com/moul/http2curl 29 | ``` 30 | 31 | ## Usages 32 | 33 | - https://github.com/parnurzeal/gorequest 34 | - https://github.com/scaleway/scaleway-cli 35 | - https://github.com/nmonterroso/cowsay-slackapp 36 | - https://github.com/moul/as-a-service 37 | 38 | ## License 39 | 40 | MIT 41 | -------------------------------------------------------------------------------- /vendor/github.com/moul/http2curl/http2curl.go: -------------------------------------------------------------------------------- 1 | package http2curl 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "io/ioutil" 8 | "net/http" 9 | "sort" 10 | "strings" 11 | ) 12 | 13 | // CurlCommand contains exec.Command compatible slice + helpers 14 | type CurlCommand struct { 15 | slice []string 16 | } 17 | 18 | // append appends a string to the CurlCommand 19 | func (c *CurlCommand) append(newSlice ...string) { 20 | c.slice = append(c.slice, newSlice...) 21 | } 22 | 23 | // String returns a ready to copy/paste command 24 | func (c *CurlCommand) String() string { 25 | slice := make([]string, len(c.slice)) 26 | copy(slice, c.slice) 27 | for i := range slice { 28 | quoted := fmt.Sprintf("%q", slice[i]) 29 | if strings.Contains(slice[i], " ") || len(quoted) != len(slice[i])+2 { 30 | slice[i] = quoted 31 | } 32 | } 33 | return strings.Join(slice, " ") 34 | } 35 | 36 | // nopCloser is used to create a new io.ReadCloser for req.Body 37 | type nopCloser struct { 38 | io.Reader 39 | } 40 | 41 | func (nopCloser) Close() error { return nil } 42 | 43 | // GetCurlCommand returns a CurlCommand corresponding to an http.Request 44 | func GetCurlCommand(req *http.Request) (*CurlCommand, error) { 45 | command := CurlCommand{} 46 | 47 | command.append("curl") 48 | 49 | command.append("-X", req.Method) 50 | 51 | if req.Body != nil { 52 | body, err := ioutil.ReadAll(req.Body) 53 | if err != nil { 54 | return nil, err 55 | } 56 | req.Body = nopCloser{bytes.NewBuffer(body)} 57 | command.append("-d", fmt.Sprintf("%s", bytes.Trim(body, "\n"))) 58 | } 59 | 60 | var keys []string 61 | 62 | for k := range req.Header { 63 | keys = append(keys, k) 64 | } 65 | sort.Strings(keys) 66 | 67 | for _, k := range keys { 68 | command.append("-H", fmt.Sprintf("%s: %s", k, strings.Join(req.Header[k], " "))) 69 | } 70 | 71 | command.append(fmt.Sprintf("'%v'", req.URL.String())) 72 | 73 | return &command, nil 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/mvdan/xurls/.gitignore: -------------------------------------------------------------------------------- 1 | cmd/xurls/xurls 2 | generate/tldsgen/tldsgen 3 | generate/regexgen/regexgen 4 | -------------------------------------------------------------------------------- /vendor/github.com/mvdan/xurls/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.7 5 | -------------------------------------------------------------------------------- /vendor/github.com/mvdan/xurls/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Daniel Martí. 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 the copyright holder 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 | -------------------------------------------------------------------------------- /vendor/github.com/mvdan/xurls/README.md: -------------------------------------------------------------------------------- 1 | # xurls 2 | 3 | [![GoDoc](https://godoc.org/github.com/mvdan/xurls?status.svg)](https://godoc.org/github.com/mvdan/xurls) 4 | [![Travis](https://travis-ci.org/mvdan/xurls.svg?branch=master)](https://travis-ci.org/mvdan/xurls) 5 | 6 | Extract urls from text using regular expressions. 7 | 8 | go get -u github.com/mvdan/xurls 9 | 10 | ```go 11 | import "github.com/mvdan/xurls" 12 | 13 | func main() { 14 | xurls.Relaxed.FindString("Do gophers live in golang.org?") 15 | // "golang.org" 16 | xurls.Strict.FindAllString("foo.com is http://foo.com/.", -1) 17 | // []string{"http://foo.com/"} 18 | } 19 | ``` 20 | 21 | `Relaxed` is around five times slower than `Strict` since it does more 22 | work to find the URLs without relying on the scheme: 23 | 24 | ``` 25 | BenchmarkStrictEmpty-4 1000000 1885 ns/op 26 | BenchmarkStrictSingle-4 200000 8356 ns/op 27 | BenchmarkStrictMany-4 100000 22547 ns/op 28 | BenchmarkRelaxedEmpty-4 200000 7284 ns/op 29 | BenchmarkRelaxedSingle-4 30000 58557 ns/op 30 | BenchmarkRelaxedMany-4 10000 130251 ns/op 31 | ``` 32 | 33 | #### cmd/xurls 34 | 35 | go get -u github.com/mvdan/xurls/cmd/xurls 36 | 37 | ```shell 38 | $ echo "Do gophers live in http://golang.org?" | xurls 39 | http://golang.org 40 | ``` 41 | -------------------------------------------------------------------------------- /vendor/github.com/mvdan/xurls/schemes.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, Daniel Martí 2 | // See LICENSE for licensing information 3 | 4 | package xurls 5 | 6 | // SchemesNoAuthority is a sorted list of some well-known url schemes that are 7 | // followed by ":" instead of "://". Since these are more prone to false 8 | // positives, we limit their matching. 9 | var SchemesNoAuthority = []string{ 10 | `bitcoin`, // Bitcoin 11 | `file`, // Files 12 | `magnet`, // Torrent magnets 13 | `mailto`, // Mail 14 | `sms`, // SMS 15 | `tel`, // Telephone 16 | `xmpp`, // XMPP 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/mvdan/xurls/tlds_pseudo.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, Daniel Martí 2 | // See LICENSE for licensing information 3 | 4 | package xurls 5 | 6 | // PseudoTLDs is a sorted list of some widely used unofficial TLDs. 7 | // 8 | // Sources: 9 | // * https://en.wikipedia.org/wiki/Pseudo-top-level_domain 10 | // * https://en.wikipedia.org/wiki/Category:Pseudo-top-level_domains 11 | // * https://tools.ietf.org/html/draft-grothoff-iesg-special-use-p2p-names-00 12 | // * https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml 13 | var PseudoTLDs = []string{ 14 | `bit`, // Namecoin 15 | `example`, // Example domain 16 | `exit`, // Tor exit node 17 | `gnu`, // GNS by public key 18 | `i2p`, // I2P network 19 | `invalid`, // Invalid domain 20 | `local`, // Local network 21 | `localhost`, // Local network 22 | `onion`, // Tor hidden services 23 | `test`, // Test domain 24 | `zkey`, // GNS domain name 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/mvdan/xurls/xurls.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015, Daniel Martí 2 | // See LICENSE for licensing information 3 | 4 | // Package xurls extracts urls from plain text using regular expressions. 5 | package xurls 6 | 7 | import "regexp" 8 | 9 | //go:generate go run generate/tldsgen/main.go 10 | //go:generate go run generate/regexgen/main.go 11 | 12 | const ( 13 | letter = `\p{L}` 14 | number = `\p{N}` 15 | iriChar = letter + number 16 | currency = `\p{Sc}` 17 | otherSymb = `\p{So}` 18 | endChar = iriChar + `/\-+_&~*%=#` + currency + otherSymb 19 | midChar = endChar + `@.,:;'?!|` 20 | wellParen = `\([` + midChar + `]*(\([` + midChar + `]*\)[` + midChar + `]*)*\)` 21 | wellBrack = `\[[` + midChar + `]*(\[[` + midChar + `]*\][` + midChar + `]*)*\]` 22 | wellBrace = `\{[` + midChar + `]*(\{[` + midChar + `]*\}[` + midChar + `]*)*\}` 23 | wellAll = wellParen + `|` + wellBrack + `|` + wellBrace 24 | pathCont = `([` + midChar + `]*(` + wellAll + `|[` + endChar + `])+)+` 25 | comScheme = `[a-zA-Z][a-zA-Z.\-+]*://` 26 | scheme = `(` + comScheme + `|` + otherScheme + `)` 27 | 28 | iri = `[` + iriChar + `]([` + iriChar + `\-]*[` + iriChar + `])?` 29 | domain = `(` + iri + `\.)+` 30 | octet = `(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])` 31 | ipv4Addr = `\b` + octet + `\.` + octet + `\.` + octet + `\.` + octet + `\b` 32 | ipv6Addr = `([0-9a-fA-F]{1,4}:([0-9a-fA-F]{1,4}:([0-9a-fA-F]{1,4}:([0-9a-fA-F]{1,4}:([0-9a-fA-F]{1,4}:[0-9a-fA-F]{0,4}|:[0-9a-fA-F]{1,4})?|(:[0-9a-fA-F]{1,4}){0,2})|(:[0-9a-fA-F]{1,4}){0,3})|(:[0-9a-fA-F]{1,4}){0,4})|:(:[0-9a-fA-F]{1,4}){0,5})((:[0-9a-fA-F]{1,4}){2}|:(25[0-5]|(2[0-4]|1[0-9]|[1-9])?[0-9])(\.(25[0-5]|(2[0-4]|1[0-9]|[1-9])?[0-9])){3})|(([0-9a-fA-F]{1,4}:){1,6}|:):[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){7}:` 33 | ipAddr = `(` + ipv4Addr + `|` + ipv6Addr + `)` 34 | site = domain + gtld 35 | hostName = `(` + site + `|` + ipAddr + `)` 36 | port = `(:[0-9]*)?` 37 | path = `(/|/` + pathCont + `?|\b|$)` 38 | webURL = hostName + port + path 39 | 40 | strict = `(\b` + scheme + pathCont + `)` 41 | relaxed = `(` + strict + `|` + webURL + `)` 42 | ) 43 | 44 | var ( 45 | // Relaxed matches all the urls it can find. 46 | Relaxed = regexp.MustCompile(relaxed) 47 | // Strict only matches urls with a scheme to avoid false positives. 48 | Strict = regexp.MustCompile(strict) 49 | ) 50 | 51 | func init() { 52 | Relaxed.Longest() 53 | Strict.Longest() 54 | } 55 | 56 | // StrictMatchingScheme produces a regexp that matches urls like Strict but 57 | // whose scheme matches the given regular expression. 58 | func StrictMatchingScheme(exp string) (*regexp.Regexp, error) { 59 | strictMatching := `(\b(?i)(` + exp + `)(?-i)` + pathCont + `)` 60 | re, err := regexp.Compile(strictMatching) 61 | if err != nil { 62 | return nil, err 63 | } 64 | re.Longest() 65 | return re, nil 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/parnurzeal/gorequest/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | .idea 10 | 11 | # Architecture specific extensions/prefixes 12 | *.[568vq] 13 | [568vq].out 14 | 15 | *.cgo1.go 16 | *.cgo2.c 17 | _cgo_defun.c 18 | _cgo_gotypes.go 19 | _cgo_export.* 20 | 21 | _testmain.go 22 | 23 | *.exe 24 | tags 25 | -------------------------------------------------------------------------------- /vendor/github.com/parnurzeal/gorequest/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.6 4 | - 1.5 5 | - 1.4 6 | - 1.3 7 | - 1.2 8 | install: 9 | - go get github.com/elazarl/goproxy 10 | - go get github.com/moul/http2curl 11 | - go get golang.org/x/net/publicsuffix 12 | notifications: 13 | email: 14 | recipients: parnurzeal@gmail.com 15 | on_success: change 16 | on_failure: always 17 | -------------------------------------------------------------------------------- /vendor/github.com/parnurzeal/gorequest/CHANGELOG: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | v0.2.13 (2015-11-21) 5 | 6 | Features 7 | * Add DisableTransportSwap to stop gorequest from modifying Transport settings. 8 | Note that this will effect many functions that modify gorequest's 9 | tranport. (So, use with caution.) (Bug #47, PR #59 by @piotrmiskiewicz) 10 | 11 | 12 | v0.2.12 (2015-11-21) 13 | 14 | Features 15 | * Add SetCurlCommand for printing comparable CURL command of the request 16 | (PR #60 by @QuentinPerez) 17 | 18 | v0.2.11 (2015-10-24) 19 | 20 | Bug/Fixes 21 | * Add support to Slice data structure (Bug #40, #42) 22 | * Refactor sendStruct to be public function SendStruct 23 | 24 | v0.2.10 (2015-10-24) 25 | 26 | Bug/Fixes 27 | * Fix incorrect text output in tests (PR #52 by @QuentinPerez) 28 | * Fix Panic and runtime error properly (PR #53 by @QuentinPerez) 29 | * Add support for "text/plain" and "application/xml" (PR #51 by 30 | @smallnest) 31 | * Content-Type header is also equivalent with Type function to identify 32 | supported Gorequest's Target Type 33 | 34 | v0.2.9 (2015-08-16) 35 | 36 | Bug/Fixes 37 | * ParseQuery accepts ; as a synonym for &. thus Gorequest Query won't 38 | accept ; as in a query string. We add additional Param to solve this (PR 39 | #43 by @6david9) 40 | * AddCookies for bulk adding cookies (PR #46 by @pencil001) 41 | 42 | v0.2.8 (2015-08-10) 43 | 44 | Bug/Fixes 45 | * Added SetDebug and SetLogger for debug mode (PR #28 by @dafang) 46 | * Ensure the response Body is reusable (PR #37 by alaingilbert) 47 | 48 | v0.2.7 (2015-07-11) 49 | 50 | Bug/Fixes 51 | * Incorrectly reset "Authentication" header (Hot fix by @na-ga PR #38 & Issue #39) 52 | 53 | v0.2.6 (2015-07-10) 54 | 55 | Features 56 | * Added EndBytes (PR #30 by @jaytaylor) 57 | 58 | v0.2.5 (2015-07-01) 59 | 60 | Features 61 | * Added Basic Auth support (pull request #24 by @dickeyxxx) 62 | 63 | Bug/Fixes 64 | * Fix #31 incorrect number conversion (PR #34 by @killix) 65 | 66 | v0.2.4 (2015-04-13) 67 | 68 | Features 69 | * Query() now supports Struct as same as Send() (pull request #25 by @figlief) 70 | 71 | v0.2.3 (2015-02-08) 72 | 73 | Features 74 | * Added Patch HTTP Method 75 | 76 | Bug/Fixes 77 | * Refactored testing code 78 | 79 | v0.2.2 (2015-01-03) 80 | 81 | Features 82 | * Added TLSClientConfig for better control over tls 83 | * Added AddCookie func to set "Cookie" field in request (pull request #17 by @austinov) - Issue #7 84 | * Added CookieJar (pull request #15 by @kemadz) 85 | 86 | v0.2.1 (2014-07-06) 87 | 88 | Features 89 | * Implemented timeout test 90 | 91 | Bugs/Fixes 92 | * Improved timeout feature by control over both dial + read/write timeout compared to previously controlling only dial connection timeout. 93 | 94 | v0.2.0 (2014-06-13) - Send is now supporting Struct type as a parameter 95 | 96 | v0.1.0 (2014-04-14) - Finished release with enough rich functions to do get, post, json and redirectpolicy 97 | 98 | -------------------------------------------------------------------------------- /vendor/github.com/parnurzeal/gorequest/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Theeraphol Wattanavekin 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 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/pkg/errors 3 | go: 4 | - 1.4.x 5 | - 1.5.x 6 | - 1.6.x 7 | - 1.7.x 8 | - 1.8.x 9 | - tip 10 | 11 | script: 12 | - go test -v ./... 13 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/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 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/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 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/errors/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: build-{build}.{branch} 2 | 3 | clone_folder: C:\gopath\src\github.com\pkg\errors 4 | shallow_clone: true # for startup speed 5 | 6 | environment: 7 | GOPATH: C:\gopath 8 | 9 | platform: 10 | - x64 11 | 12 | # http://www.appveyor.com/docs/installed-software 13 | install: 14 | # some helpful output for debugging builds 15 | - go version 16 | - go env 17 | # pre-installed MinGW at C:\MinGW is 32bit only 18 | # but MSYS2 at C:\msys64 has mingw64 19 | - set PATH=C:\msys64\mingw64\bin;%PATH% 20 | - gcc --version 21 | - g++ --version 22 | 23 | build_script: 24 | - go install -v ./... 25 | 26 | test_script: 27 | - set PATH=C:\gopath\bin;%PATH% 28 | - go test -v ./... 29 | 30 | #artifacts: 31 | # - path: '%GOPATH%\bin\*.exe' 32 | deploy: off 33 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.5 4 | - tip 5 | matrix: 6 | allow_failures: 7 | - go: tip 8 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Olivier Poitrey 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/README.md: -------------------------------------------------------------------------------- 1 | # Globally Unique ID Generator 2 | 3 | [![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/rs/xid) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/rs/xid/master/LICENSE) [![Build Status](https://travis-ci.org/rs/xid.svg?branch=master)](https://travis-ci.org/rs/xid) [![Coverage](http://gocover.io/_badge/github.com/rs/xid)](http://gocover.io/github.com/rs/xid) 4 | 5 | Package xid is a globally unique id generator library, ready to be used safely directly in your server code. 6 | 7 | Xid is using Mongo Object ID algorithm to generate globally unique ids with a different serialization (bast64) to make it shorter when transported as a string: 8 | https://docs.mongodb.org/manual/reference/object-id/ 9 | 10 | - 4-byte value representing the seconds since the Unix epoch, 11 | - 3-byte machine identifier, 12 | - 2-byte process id, and 13 | - 3-byte counter, starting with a random value. 14 | 15 | The binary representation of the id is compatible with Mongo 12 bytes Object IDs. 16 | The string representation is using base32 hex (w/o padding) for better space efficiency 17 | when stored in that form (20 bytes). The hex variant of base32 is used to retain the 18 | sortable property of the id. 19 | 20 | Xid doesn't use base64 because case sensitivity and the 2 non alphanum chars may be an 21 | issue when transported as a string between various systems. Base36 wasn't retained either 22 | because 1/ it's not standard 2/ the resulting size is not predictable (not bit aligned) 23 | and 3/ it would not remain sortable. To validate a base32 `xid`, expect a 20 chars long, 24 | all lowercase sequence of `a` to `v` letters and `0` to `9` numbers (`[0-9a-v]{20}`). 25 | 26 | UUIDs are 16 bytes (128 bits) and 36 chars as string representation. Twitter Snowflake 27 | ids are 8 bytes (64 bits) but require machine/data-center configuration and/or central 28 | generator servers. xid stands in between with 12 bytes (96 bits) and a more compact 29 | URL-safe string representation (20 chars). No configuration or central generator server 30 | is required so it can be used directly in server's code. 31 | 32 | | Name | Binary Size | String Size | Features 33 | |-------------|-------------|----------------|---------------- 34 | | [UUID] | 16 bytes | 36 chars | configuration free, not sortable 35 | | [shortuuid] | 16 bytes | 22 chars | configuration free, not sortable 36 | | [Snowflake] | 8 bytes | up to 20 chars | needs machin/DC configuration, needs central server, sortable 37 | | [MongoID] | 12 bytes | 24 chars | configuration free, sortable 38 | | xid | 12 bytes | 20 chars | configuration free, sortable 39 | 40 | [UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier 41 | [shortuuid]: https://github.com/stochastic-technologies/shortuuid 42 | [Snowflake]: https://blog.twitter.com/2010/announcing-snowflake 43 | [MongoID]: https://docs.mongodb.org/manual/reference/object-id/ 44 | 45 | Features: 46 | 47 | - Size: 12 bytes (96 bits), smaller than UUID, larger than snowflake 48 | - Base32 hex encoded by default (20 chars when transported as printable string, still sortable) 49 | - Non configured, you don't need set a unique machine and/or data center id 50 | - K-ordered 51 | - Embedded time with 1 second precision 52 | - Unicity guaranteed for 16,777,216 (24 bits) unique ids per second and per host/process 53 | 54 | Best used with [xlog](https://github.com/rs/xlog)'s 55 | [RequestIDHandler](https://godoc.org/github.com/rs/xlog#RequestIDHandler). 56 | 57 | References: 58 | 59 | - http://www.slideshare.net/davegardnerisme/unique-id-generation-in-distributed-systems 60 | - https://en.wikipedia.org/wiki/Universally_unique_identifier 61 | - https://blog.twitter.com/2010/announcing-snowflake 62 | 63 | ## Install 64 | 65 | go get github.com/rs/xid 66 | 67 | ## Usage 68 | 69 | ```go 70 | guid := xid.New() 71 | 72 | println(guid.String()) 73 | // Output: 9m4e2mr0ui3e8a215n4g 74 | ``` 75 | 76 | Get `xid` embedded info: 77 | 78 | ```go 79 | guid.Machine() 80 | guid.Pid() 81 | guid.Time() 82 | guid.Counter() 83 | ``` 84 | 85 | ## Licenses 86 | 87 | All source code is licensed under the [MIT License](https://raw.github.com/rs/xid/master/LICENSE). 88 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/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 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/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 | package context 8 | 9 | import ( 10 | "context" // standard library's context, as of Go 1.7 11 | "time" 12 | ) 13 | 14 | var ( 15 | todo = context.TODO() 16 | background = context.Background() 17 | ) 18 | 19 | // Canceled is the error returned by Context.Err when the context is canceled. 20 | var Canceled = context.Canceled 21 | 22 | // DeadlineExceeded is the error returned by Context.Err when the context's 23 | // deadline passes. 24 | var DeadlineExceeded = context.DeadlineExceeded 25 | 26 | // WithCancel returns a copy of parent with a new Done channel. The returned 27 | // context's Done channel is closed when the returned cancel function is called 28 | // or when the parent context's Done channel is closed, whichever happens first. 29 | // 30 | // Canceling this context releases resources associated with it, so code should 31 | // call cancel as soon as the operations running in this Context complete. 32 | func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { 33 | ctx, f := context.WithCancel(parent) 34 | return ctx, CancelFunc(f) 35 | } 36 | 37 | // WithDeadline returns a copy of the parent context with the deadline adjusted 38 | // to be no later than d. If the parent's deadline is already earlier than d, 39 | // WithDeadline(parent, d) is semantically equivalent to parent. The returned 40 | // context's Done channel is closed when the deadline expires, when the returned 41 | // cancel function is called, or when the parent context's Done channel is 42 | // closed, whichever happens first. 43 | // 44 | // Canceling this context releases resources associated with it, so code should 45 | // call cancel as soon as the operations running in this Context complete. 46 | func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { 47 | ctx, f := context.WithDeadline(parent, deadline) 48 | return ctx, CancelFunc(f) 49 | } 50 | 51 | // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). 52 | // 53 | // Canceling this context releases resources associated with it, so code should 54 | // call cancel as soon as the operations running in this Context complete: 55 | // 56 | // func slowOperationWithTimeout(ctx context.Context) (Result, error) { 57 | // ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) 58 | // defer cancel() // releases resources if slowOperation completes before timeout elapses 59 | // return slowOperation(ctx) 60 | // } 61 | func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { 62 | return WithDeadline(parent, time.Now().Add(timeout)) 63 | } 64 | 65 | // WithValue returns a copy of parent in which the value associated with key is 66 | // val. 67 | // 68 | // Use context Values only for request-scoped data that transits processes and 69 | // APIs, not for passing optional parameters to functions. 70 | func WithValue(parent Context, key interface{}, val interface{}) Context { 71 | return context.WithValue(parent, key, val) 72 | } 73 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/publicsuffix/list.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 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 | //go:generate go run gen.go 6 | 7 | // Package publicsuffix provides a public suffix list based on data from 8 | // http://publicsuffix.org/. A public suffix is one under which Internet users 9 | // can directly register names. 10 | package publicsuffix 11 | 12 | // TODO: specify case sensitivity and leading/trailing dot behavior for 13 | // func PublicSuffix and func EffectiveTLDPlusOne. 14 | 15 | import ( 16 | "fmt" 17 | "net/http/cookiejar" 18 | "strings" 19 | ) 20 | 21 | // List implements the cookiejar.PublicSuffixList interface by calling the 22 | // PublicSuffix function. 23 | var List cookiejar.PublicSuffixList = list{} 24 | 25 | type list struct{} 26 | 27 | func (list) PublicSuffix(domain string) string { 28 | ps, _ := PublicSuffix(domain) 29 | return ps 30 | } 31 | 32 | func (list) String() string { 33 | return version 34 | } 35 | 36 | // PublicSuffix returns the public suffix of the domain using a copy of the 37 | // publicsuffix.org database compiled into the library. 38 | // 39 | // icann is whether the public suffix is managed by the Internet Corporation 40 | // for Assigned Names and Numbers. If not, the public suffix is privately 41 | // managed. For example, foo.org and foo.co.uk are ICANN domains, 42 | // foo.dyndns.org and foo.blogspot.co.uk are private domains. 43 | // 44 | // Use cases for distinguishing ICANN domains like foo.com from private 45 | // domains like foo.appspot.com can be found at 46 | // https://wiki.mozilla.org/Public_Suffix_List/Use_Cases 47 | func PublicSuffix(domain string) (publicSuffix string, icann bool) { 48 | lo, hi := uint32(0), uint32(numTLD) 49 | s, suffix, wildcard := domain, len(domain), false 50 | loop: 51 | for { 52 | dot := strings.LastIndex(s, ".") 53 | if wildcard { 54 | suffix = 1 + dot 55 | } 56 | if lo == hi { 57 | break 58 | } 59 | f := find(s[1+dot:], lo, hi) 60 | if f == notFound { 61 | break 62 | } 63 | 64 | u := nodes[f] >> (nodesBitsTextOffset + nodesBitsTextLength) 65 | icann = u&(1<>= nodesBitsICANN 67 | u = children[u&(1<>= childrenBitsLo 70 | hi = u & (1<>= childrenBitsHi 72 | switch u & (1<>= childrenBitsNodeType 80 | wildcard = u&(1<>= nodesBitsTextLength 119 | offset := x & (1< 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/Makefile: -------------------------------------------------------------------------------- 1 | startdb: 2 | @harness/setup.sh start 3 | 4 | stopdb: 5 | @harness/setup.sh stop 6 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/README.md: -------------------------------------------------------------------------------- 1 | The MongoDB driver for Go 2 | ------------------------- 3 | 4 | Please go to [http://labix.org/mgo](http://labix.org/mgo) for all project details. 5 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/bson/LICENSE: -------------------------------------------------------------------------------- 1 | BSON library for Go 2 | 3 | Copyright (c) 2010-2012 - Gustavo Niemeyer 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/doc.go: -------------------------------------------------------------------------------- 1 | // Package mgo offers a rich MongoDB driver for Go. 2 | // 3 | // Details about the mgo project (pronounced as "mango") are found 4 | // in its web page: 5 | // 6 | // http://labix.org/mgo 7 | // 8 | // Usage of the driver revolves around the concept of sessions. To 9 | // get started, obtain a session using the Dial function: 10 | // 11 | // session, err := mgo.Dial(url) 12 | // 13 | // This will establish one or more connections with the cluster of 14 | // servers defined by the url parameter. From then on, the cluster 15 | // may be queried with multiple consistency rules (see SetMode) and 16 | // documents retrieved with statements such as: 17 | // 18 | // c := session.DB(database).C(collection) 19 | // err := c.Find(query).One(&result) 20 | // 21 | // New sessions are typically created by calling session.Copy on the 22 | // initial session obtained at dial time. These new sessions will share 23 | // the same cluster information and connection pool, and may be easily 24 | // handed into other methods and functions for organizing logic. 25 | // Every session created must have its Close method called at the end 26 | // of its life time, so its resources may be put back in the pool or 27 | // collected, depending on the case. 28 | // 29 | // For more details, see the documentation for the types and methods. 30 | // 31 | package mgo 32 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/json/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 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 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/json/extension.go: -------------------------------------------------------------------------------- 1 | package json 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | // Extension holds a set of additional rules to be used when unmarshaling 8 | // strict JSON or JSON-like content. 9 | type Extension struct { 10 | funcs map[string]funcExt 11 | consts map[string]interface{} 12 | keyed map[string]func([]byte) (interface{}, error) 13 | encode map[reflect.Type]func(v interface{}) ([]byte, error) 14 | 15 | unquotedKeys bool 16 | trailingCommas bool 17 | } 18 | 19 | type funcExt struct { 20 | key string 21 | args []string 22 | } 23 | 24 | // Extend changes the decoder behavior to consider the provided extension. 25 | func (dec *Decoder) Extend(ext *Extension) { dec.d.ext = *ext } 26 | 27 | // Extend changes the encoder behavior to consider the provided extension. 28 | func (enc *Encoder) Extend(ext *Extension) { enc.ext = *ext } 29 | 30 | // Extend includes in e the extensions defined in ext. 31 | func (e *Extension) Extend(ext *Extension) { 32 | for name, fext := range ext.funcs { 33 | e.DecodeFunc(name, fext.key, fext.args...) 34 | } 35 | for name, value := range ext.consts { 36 | e.DecodeConst(name, value) 37 | } 38 | for key, decode := range ext.keyed { 39 | e.DecodeKeyed(key, decode) 40 | } 41 | for typ, encode := range ext.encode { 42 | if e.encode == nil { 43 | e.encode = make(map[reflect.Type]func(v interface{}) ([]byte, error)) 44 | } 45 | e.encode[typ] = encode 46 | } 47 | } 48 | 49 | // DecodeFunc defines a function call that may be observed inside JSON content. 50 | // A function with the provided name will be unmarshaled as the document 51 | // {key: {args[0]: ..., args[N]: ...}}. 52 | func (e *Extension) DecodeFunc(name string, key string, args ...string) { 53 | if e.funcs == nil { 54 | e.funcs = make(map[string]funcExt) 55 | } 56 | e.funcs[name] = funcExt{key, args} 57 | } 58 | 59 | // DecodeConst defines a constant name that may be observed inside JSON content 60 | // and will be decoded with the provided value. 61 | func (e *Extension) DecodeConst(name string, value interface{}) { 62 | if e.consts == nil { 63 | e.consts = make(map[string]interface{}) 64 | } 65 | e.consts[name] = value 66 | } 67 | 68 | // DecodeKeyed defines a key that when observed as the first element inside a 69 | // JSON document triggers the decoding of that document via the provided 70 | // decode function. 71 | func (e *Extension) DecodeKeyed(key string, decode func(data []byte) (interface{}, error)) { 72 | if e.keyed == nil { 73 | e.keyed = make(map[string]func([]byte) (interface{}, error)) 74 | } 75 | e.keyed[key] = decode 76 | } 77 | 78 | // DecodeUnquotedKeys defines whether to accept map keys that are unquoted strings. 79 | func (e *Extension) DecodeUnquotedKeys(accept bool) { 80 | e.unquotedKeys = accept 81 | } 82 | 83 | // DecodeTrailingCommas defines whether to accept trailing commas in maps and arrays. 84 | func (e *Extension) DecodeTrailingCommas(accept bool) { 85 | e.trailingCommas = accept 86 | } 87 | 88 | // EncodeType registers a function to encode values with the same type of the 89 | // provided sample. 90 | func (e *Extension) EncodeType(sample interface{}, encode func(v interface{}) ([]byte, error)) { 91 | if e.encode == nil { 92 | e.encode = make(map[reflect.Type]func(v interface{}) ([]byte, error)) 93 | } 94 | e.encode[reflect.TypeOf(sample)] = encode 95 | } 96 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/json/fold.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 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 | package json 6 | 7 | import ( 8 | "bytes" 9 | "unicode/utf8" 10 | ) 11 | 12 | const ( 13 | caseMask = ^byte(0x20) // Mask to ignore case in ASCII. 14 | kelvin = '\u212a' 15 | smallLongEss = '\u017f' 16 | ) 17 | 18 | // foldFunc returns one of four different case folding equivalence 19 | // functions, from most general (and slow) to fastest: 20 | // 21 | // 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 22 | // 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') 23 | // 3) asciiEqualFold, no special, but includes non-letters (including _) 24 | // 4) simpleLetterEqualFold, no specials, no non-letters. 25 | // 26 | // The letters S and K are special because they map to 3 runes, not just 2: 27 | // * S maps to s and to U+017F 'ſ' Latin small letter long s 28 | // * k maps to K and to U+212A 'K' Kelvin sign 29 | // See https://play.golang.org/p/tTxjOc0OGo 30 | // 31 | // The returned function is specialized for matching against s and 32 | // should only be given s. It's not curried for performance reasons. 33 | func foldFunc(s []byte) func(s, t []byte) bool { 34 | nonLetter := false 35 | special := false // special letter 36 | for _, b := range s { 37 | if b >= utf8.RuneSelf { 38 | return bytes.EqualFold 39 | } 40 | upper := b & caseMask 41 | if upper < 'A' || upper > 'Z' { 42 | nonLetter = true 43 | } else if upper == 'K' || upper == 'S' { 44 | // See above for why these letters are special. 45 | special = true 46 | } 47 | } 48 | if special { 49 | return equalFoldRight 50 | } 51 | if nonLetter { 52 | return asciiEqualFold 53 | } 54 | return simpleLetterEqualFold 55 | } 56 | 57 | // equalFoldRight is a specialization of bytes.EqualFold when s is 58 | // known to be all ASCII (including punctuation), but contains an 's', 59 | // 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. 60 | // See comments on foldFunc. 61 | func equalFoldRight(s, t []byte) bool { 62 | for _, sb := range s { 63 | if len(t) == 0 { 64 | return false 65 | } 66 | tb := t[0] 67 | if tb < utf8.RuneSelf { 68 | if sb != tb { 69 | sbUpper := sb & caseMask 70 | if 'A' <= sbUpper && sbUpper <= 'Z' { 71 | if sbUpper != tb&caseMask { 72 | return false 73 | } 74 | } else { 75 | return false 76 | } 77 | } 78 | t = t[1:] 79 | continue 80 | } 81 | // sb is ASCII and t is not. t must be either kelvin 82 | // sign or long s; sb must be s, S, k, or K. 83 | tr, size := utf8.DecodeRune(t) 84 | switch sb { 85 | case 's', 'S': 86 | if tr != smallLongEss { 87 | return false 88 | } 89 | case 'k', 'K': 90 | if tr != kelvin { 91 | return false 92 | } 93 | default: 94 | return false 95 | } 96 | t = t[size:] 97 | 98 | } 99 | if len(t) > 0 { 100 | return false 101 | } 102 | return true 103 | } 104 | 105 | // asciiEqualFold is a specialization of bytes.EqualFold for use when 106 | // s is all ASCII (but may contain non-letters) and contains no 107 | // special-folding letters. 108 | // See comments on foldFunc. 109 | func asciiEqualFold(s, t []byte) bool { 110 | if len(s) != len(t) { 111 | return false 112 | } 113 | for i, sb := range s { 114 | tb := t[i] 115 | if sb == tb { 116 | continue 117 | } 118 | if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { 119 | if sb&caseMask != tb&caseMask { 120 | return false 121 | } 122 | } else { 123 | return false 124 | } 125 | } 126 | return true 127 | } 128 | 129 | // simpleLetterEqualFold is a specialization of bytes.EqualFold for 130 | // use when s is all ASCII letters (no underscores, etc) and also 131 | // doesn't contain 'k', 'K', 's', or 'S'. 132 | // See comments on foldFunc. 133 | func simpleLetterEqualFold(s, t []byte) bool { 134 | if len(s) != len(t) { 135 | return false 136 | } 137 | for i, b := range s { 138 | if b&caseMask != t[i]&caseMask { 139 | return false 140 | } 141 | } 142 | return true 143 | } 144 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/json/indent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 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 | package json 6 | 7 | import "bytes" 8 | 9 | // Compact appends to dst the JSON-encoded src with 10 | // insignificant space characters elided. 11 | func Compact(dst *bytes.Buffer, src []byte) error { 12 | return compact(dst, src, false) 13 | } 14 | 15 | func compact(dst *bytes.Buffer, src []byte, escape bool) error { 16 | origLen := dst.Len() 17 | var scan scanner 18 | scan.reset() 19 | start := 0 20 | for i, c := range src { 21 | if escape && (c == '<' || c == '>' || c == '&') { 22 | if start < i { 23 | dst.Write(src[start:i]) 24 | } 25 | dst.WriteString(`\u00`) 26 | dst.WriteByte(hex[c>>4]) 27 | dst.WriteByte(hex[c&0xF]) 28 | start = i + 1 29 | } 30 | // Convert U+2028 and U+2029 (E2 80 A8 and E2 80 A9). 31 | if c == 0xE2 && i+2 < len(src) && src[i+1] == 0x80 && src[i+2]&^1 == 0xA8 { 32 | if start < i { 33 | dst.Write(src[start:i]) 34 | } 35 | dst.WriteString(`\u202`) 36 | dst.WriteByte(hex[src[i+2]&0xF]) 37 | start = i + 3 38 | } 39 | v := scan.step(&scan, c) 40 | if v >= scanSkipSpace { 41 | if v == scanError { 42 | break 43 | } 44 | if start < i { 45 | dst.Write(src[start:i]) 46 | } 47 | start = i + 1 48 | } 49 | } 50 | if scan.eof() == scanError { 51 | dst.Truncate(origLen) 52 | return scan.err 53 | } 54 | if start < len(src) { 55 | dst.Write(src[start:]) 56 | } 57 | return nil 58 | } 59 | 60 | func newline(dst *bytes.Buffer, prefix, indent string, depth int) { 61 | dst.WriteByte('\n') 62 | dst.WriteString(prefix) 63 | for i := 0; i < depth; i++ { 64 | dst.WriteString(indent) 65 | } 66 | } 67 | 68 | // Indent appends to dst an indented form of the JSON-encoded src. 69 | // Each element in a JSON object or array begins on a new, 70 | // indented line beginning with prefix followed by one or more 71 | // copies of indent according to the indentation nesting. 72 | // The data appended to dst does not begin with the prefix nor 73 | // any indentation, to make it easier to embed inside other formatted JSON data. 74 | // Although leading space characters (space, tab, carriage return, newline) 75 | // at the beginning of src are dropped, trailing space characters 76 | // at the end of src are preserved and copied to dst. 77 | // For example, if src has no trailing spaces, neither will dst; 78 | // if src ends in a trailing newline, so will dst. 79 | func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error { 80 | origLen := dst.Len() 81 | var scan scanner 82 | scan.reset() 83 | needIndent := false 84 | depth := 0 85 | for _, c := range src { 86 | scan.bytes++ 87 | v := scan.step(&scan, c) 88 | if v == scanSkipSpace { 89 | continue 90 | } 91 | if v == scanError { 92 | break 93 | } 94 | if needIndent && v != scanEndObject && v != scanEndArray { 95 | needIndent = false 96 | depth++ 97 | newline(dst, prefix, indent, depth) 98 | } 99 | 100 | // Emit semantically uninteresting bytes 101 | // (in particular, punctuation in strings) unmodified. 102 | if v == scanContinue { 103 | dst.WriteByte(c) 104 | continue 105 | } 106 | 107 | // Add spacing around real punctuation. 108 | switch c { 109 | case '{', '[': 110 | // delay indent so that empty object and array are formatted as {} and []. 111 | needIndent = true 112 | dst.WriteByte(c) 113 | 114 | case ',': 115 | dst.WriteByte(c) 116 | newline(dst, prefix, indent, depth) 117 | 118 | case ':': 119 | dst.WriteByte(c) 120 | dst.WriteByte(' ') 121 | 122 | case '}', ']': 123 | if needIndent { 124 | // suppress indent in empty object/array 125 | needIndent = false 126 | } else { 127 | depth-- 128 | newline(dst, prefix, indent, depth) 129 | } 130 | dst.WriteByte(c) 131 | 132 | default: 133 | dst.WriteByte(c) 134 | } 135 | } 136 | if scan.eof() == scanError { 137 | dst.Truncate(origLen) 138 | return scan.err 139 | } 140 | return nil 141 | } 142 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/json/tags.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 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 | package json 6 | 7 | import ( 8 | "strings" 9 | ) 10 | 11 | // tagOptions is the string following a comma in a struct field's "json" 12 | // tag, or the empty string. It does not include the leading comma. 13 | type tagOptions string 14 | 15 | // parseTag splits a struct field's json tag into its name and 16 | // comma-separated options. 17 | func parseTag(tag string) (string, tagOptions) { 18 | if idx := strings.Index(tag, ","); idx != -1 { 19 | return tag[:idx], tagOptions(tag[idx+1:]) 20 | } 21 | return tag, tagOptions("") 22 | } 23 | 24 | // Contains reports whether a comma-separated list of options 25 | // contains a particular substr flag. substr must be surrounded by a 26 | // string boundary or commas. 27 | func (o tagOptions) Contains(optionName string) bool { 28 | if len(o) == 0 { 29 | return false 30 | } 31 | s := string(o) 32 | for s != "" { 33 | var next string 34 | i := strings.Index(s, ",") 35 | if i >= 0 { 36 | s, next = s[:i], s[i+1:] 37 | } 38 | if s == optionName { 39 | return true 40 | } 41 | s = next 42 | } 43 | return false 44 | } 45 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/sasl/sasl.c: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | static int mgo_sasl_simple(void *context, int id, const char **result, unsigned int *len) 9 | { 10 | if (!result) { 11 | return SASL_BADPARAM; 12 | } 13 | switch (id) { 14 | case SASL_CB_USER: 15 | *result = (char *)context; 16 | break; 17 | case SASL_CB_AUTHNAME: 18 | *result = (char *)context; 19 | break; 20 | case SASL_CB_LANGUAGE: 21 | *result = NULL; 22 | break; 23 | default: 24 | return SASL_BADPARAM; 25 | } 26 | if (len) { 27 | *len = *result ? strlen(*result) : 0; 28 | } 29 | return SASL_OK; 30 | } 31 | 32 | typedef int (*callback)(void); 33 | 34 | static int mgo_sasl_secret(sasl_conn_t *conn, void *context, int id, sasl_secret_t **result) 35 | { 36 | if (!conn || !result || id != SASL_CB_PASS) { 37 | return SASL_BADPARAM; 38 | } 39 | *result = (sasl_secret_t *)context; 40 | return SASL_OK; 41 | } 42 | 43 | sasl_callback_t *mgo_sasl_callbacks(const char *username, const char *password) 44 | { 45 | sasl_callback_t *cb = malloc(4 * sizeof(sasl_callback_t)); 46 | int n = 0; 47 | 48 | size_t len = strlen(password); 49 | sasl_secret_t *secret = (sasl_secret_t*)malloc(sizeof(sasl_secret_t) + len); 50 | if (!secret) { 51 | free(cb); 52 | return NULL; 53 | } 54 | strcpy((char *)secret->data, password); 55 | secret->len = len; 56 | 57 | cb[n].id = SASL_CB_PASS; 58 | cb[n].proc = (callback)&mgo_sasl_secret; 59 | cb[n].context = secret; 60 | n++; 61 | 62 | cb[n].id = SASL_CB_USER; 63 | cb[n].proc = (callback)&mgo_sasl_simple; 64 | cb[n].context = (char*)username; 65 | n++; 66 | 67 | cb[n].id = SASL_CB_AUTHNAME; 68 | cb[n].proc = (callback)&mgo_sasl_simple; 69 | cb[n].context = (char*)username; 70 | n++; 71 | 72 | cb[n].id = SASL_CB_LIST_END; 73 | cb[n].proc = NULL; 74 | cb[n].context = NULL; 75 | 76 | return cb; 77 | } 78 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/sasl/sasl.go: -------------------------------------------------------------------------------- 1 | // Package sasl is an implementation detail of the mgo package. 2 | // 3 | // This package is not meant to be used by itself. 4 | // 5 | 6 | // +build !windows 7 | 8 | package sasl 9 | 10 | // #cgo LDFLAGS: -lsasl2 11 | // 12 | // struct sasl_conn {}; 13 | // 14 | // #include 15 | // #include 16 | // 17 | // sasl_callback_t *mgo_sasl_callbacks(const char *username, const char *password); 18 | // 19 | import "C" 20 | 21 | import ( 22 | "fmt" 23 | "strings" 24 | "sync" 25 | "unsafe" 26 | ) 27 | 28 | type saslStepper interface { 29 | Step(serverData []byte) (clientData []byte, done bool, err error) 30 | Close() 31 | } 32 | 33 | type saslSession struct { 34 | conn *C.sasl_conn_t 35 | step int 36 | mech string 37 | 38 | cstrings []*C.char 39 | callbacks *C.sasl_callback_t 40 | } 41 | 42 | var initError error 43 | var initOnce sync.Once 44 | 45 | func initSASL() { 46 | rc := C.sasl_client_init(nil) 47 | if rc != C.SASL_OK { 48 | initError = saslError(rc, nil, "cannot initialize SASL library") 49 | } 50 | } 51 | 52 | func New(username, password, mechanism, service, host string) (saslStepper, error) { 53 | initOnce.Do(initSASL) 54 | if initError != nil { 55 | return nil, initError 56 | } 57 | 58 | ss := &saslSession{mech: mechanism} 59 | if service == "" { 60 | service = "mongodb" 61 | } 62 | if i := strings.Index(host, ":"); i >= 0 { 63 | host = host[:i] 64 | } 65 | ss.callbacks = C.mgo_sasl_callbacks(ss.cstr(username), ss.cstr(password)) 66 | rc := C.sasl_client_new(ss.cstr(service), ss.cstr(host), nil, nil, ss.callbacks, 0, &ss.conn) 67 | if rc != C.SASL_OK { 68 | ss.Close() 69 | return nil, saslError(rc, nil, "cannot create new SASL client") 70 | } 71 | return ss, nil 72 | } 73 | 74 | func (ss *saslSession) cstr(s string) *C.char { 75 | cstr := C.CString(s) 76 | ss.cstrings = append(ss.cstrings, cstr) 77 | return cstr 78 | } 79 | 80 | func (ss *saslSession) Close() { 81 | for _, cstr := range ss.cstrings { 82 | C.free(unsafe.Pointer(cstr)) 83 | } 84 | ss.cstrings = nil 85 | 86 | if ss.callbacks != nil { 87 | C.free(unsafe.Pointer(ss.callbacks)) 88 | } 89 | 90 | // The documentation of SASL dispose makes it clear that this should only 91 | // be done when the connection is done, not when the authentication phase 92 | // is done, because an encryption layer may have been negotiated. 93 | // Even then, we'll do this for now, because it's simpler and prevents 94 | // keeping track of this state for every socket. If it breaks, we'll fix it. 95 | C.sasl_dispose(&ss.conn) 96 | } 97 | 98 | func (ss *saslSession) Step(serverData []byte) (clientData []byte, done bool, err error) { 99 | ss.step++ 100 | if ss.step > 10 { 101 | return nil, false, fmt.Errorf("too many SASL steps without authentication") 102 | } 103 | var cclientData *C.char 104 | var cclientDataLen C.uint 105 | var rc C.int 106 | if ss.step == 1 { 107 | var mechanism *C.char // ignored - must match cred 108 | rc = C.sasl_client_start(ss.conn, ss.cstr(ss.mech), nil, &cclientData, &cclientDataLen, &mechanism) 109 | } else { 110 | var cserverData *C.char 111 | var cserverDataLen C.uint 112 | if len(serverData) > 0 { 113 | cserverData = (*C.char)(unsafe.Pointer(&serverData[0])) 114 | cserverDataLen = C.uint(len(serverData)) 115 | } 116 | rc = C.sasl_client_step(ss.conn, cserverData, cserverDataLen, nil, &cclientData, &cclientDataLen) 117 | } 118 | if cclientData != nil && cclientDataLen > 0 { 119 | clientData = C.GoBytes(unsafe.Pointer(cclientData), C.int(cclientDataLen)) 120 | } 121 | if rc == C.SASL_OK { 122 | return clientData, true, nil 123 | } 124 | if rc == C.SASL_CONTINUE { 125 | return clientData, false, nil 126 | } 127 | return nil, false, saslError(rc, ss.conn, "cannot establish SASL session") 128 | } 129 | 130 | func saslError(rc C.int, conn *C.sasl_conn_t, msg string) error { 131 | var detail string 132 | if conn == nil { 133 | detail = C.GoString(C.sasl_errstring(rc, nil, nil)) 134 | } else { 135 | detail = C.GoString(C.sasl_errdetail(conn)) 136 | } 137 | return fmt.Errorf(msg + ": " + detail) 138 | } 139 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c: -------------------------------------------------------------------------------- 1 | #include "sasl_windows.h" 2 | 3 | static const LPSTR SSPI_PACKAGE_NAME = "kerberos"; 4 | 5 | SECURITY_STATUS SEC_ENTRY sspi_acquire_credentials_handle(CredHandle *cred_handle, char *username, char *password, char *domain) 6 | { 7 | SEC_WINNT_AUTH_IDENTITY auth_identity; 8 | SECURITY_INTEGER ignored; 9 | 10 | auth_identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI; 11 | auth_identity.User = (LPSTR) username; 12 | auth_identity.UserLength = strlen(username); 13 | auth_identity.Password = NULL; 14 | auth_identity.PasswordLength = 0; 15 | if(password){ 16 | auth_identity.Password = (LPSTR) password; 17 | auth_identity.PasswordLength = strlen(password); 18 | } 19 | auth_identity.Domain = (LPSTR) domain; 20 | auth_identity.DomainLength = strlen(domain); 21 | return call_sspi_acquire_credentials_handle(NULL, SSPI_PACKAGE_NAME, SECPKG_CRED_OUTBOUND, NULL, &auth_identity, NULL, NULL, cred_handle, &ignored); 22 | } 23 | 24 | int sspi_step(CredHandle *cred_handle, int has_context, CtxtHandle *context, PVOID buffer, ULONG buffer_length, PVOID *out_buffer, ULONG *out_buffer_length, char *target) 25 | { 26 | SecBufferDesc inbuf; 27 | SecBuffer in_bufs[1]; 28 | SecBufferDesc outbuf; 29 | SecBuffer out_bufs[1]; 30 | 31 | if (has_context > 0) { 32 | // If we already have a context, we now have data to send. 33 | // Put this data in an inbuf. 34 | inbuf.ulVersion = SECBUFFER_VERSION; 35 | inbuf.cBuffers = 1; 36 | inbuf.pBuffers = in_bufs; 37 | in_bufs[0].pvBuffer = buffer; 38 | in_bufs[0].cbBuffer = buffer_length; 39 | in_bufs[0].BufferType = SECBUFFER_TOKEN; 40 | } 41 | 42 | outbuf.ulVersion = SECBUFFER_VERSION; 43 | outbuf.cBuffers = 1; 44 | outbuf.pBuffers = out_bufs; 45 | out_bufs[0].pvBuffer = NULL; 46 | out_bufs[0].cbBuffer = 0; 47 | out_bufs[0].BufferType = SECBUFFER_TOKEN; 48 | 49 | ULONG context_attr = 0; 50 | 51 | int ret = call_sspi_initialize_security_context(cred_handle, 52 | has_context > 0 ? context : NULL, 53 | (LPSTR) target, 54 | ISC_REQ_ALLOCATE_MEMORY | ISC_REQ_MUTUAL_AUTH, 55 | 0, 56 | SECURITY_NETWORK_DREP, 57 | has_context > 0 ? &inbuf : NULL, 58 | 0, 59 | context, 60 | &outbuf, 61 | &context_attr, 62 | NULL); 63 | 64 | *out_buffer = malloc(out_bufs[0].cbBuffer); 65 | *out_buffer_length = out_bufs[0].cbBuffer; 66 | memcpy(*out_buffer, out_bufs[0].pvBuffer, *out_buffer_length); 67 | 68 | return ret; 69 | } 70 | 71 | int sspi_send_client_authz_id(CtxtHandle *context, PVOID *buffer, ULONG *buffer_length, char *user_plus_realm) 72 | { 73 | SecPkgContext_Sizes sizes; 74 | SECURITY_STATUS status = call_sspi_query_context_attributes(context, SECPKG_ATTR_SIZES, &sizes); 75 | 76 | if (status != SEC_E_OK) { 77 | return status; 78 | } 79 | 80 | size_t user_plus_realm_length = strlen(user_plus_realm); 81 | int msgSize = 4 + user_plus_realm_length; 82 | char *msg = malloc((sizes.cbSecurityTrailer + msgSize + sizes.cbBlockSize) * sizeof(char)); 83 | msg[sizes.cbSecurityTrailer + 0] = 1; 84 | msg[sizes.cbSecurityTrailer + 1] = 0; 85 | msg[sizes.cbSecurityTrailer + 2] = 0; 86 | msg[sizes.cbSecurityTrailer + 3] = 0; 87 | memcpy(&msg[sizes.cbSecurityTrailer + 4], user_plus_realm, user_plus_realm_length); 88 | 89 | SecBuffer wrapBufs[3]; 90 | SecBufferDesc wrapBufDesc; 91 | wrapBufDesc.cBuffers = 3; 92 | wrapBufDesc.pBuffers = wrapBufs; 93 | wrapBufDesc.ulVersion = SECBUFFER_VERSION; 94 | 95 | wrapBufs[0].cbBuffer = sizes.cbSecurityTrailer; 96 | wrapBufs[0].BufferType = SECBUFFER_TOKEN; 97 | wrapBufs[0].pvBuffer = msg; 98 | 99 | wrapBufs[1].cbBuffer = msgSize; 100 | wrapBufs[1].BufferType = SECBUFFER_DATA; 101 | wrapBufs[1].pvBuffer = msg + sizes.cbSecurityTrailer; 102 | 103 | wrapBufs[2].cbBuffer = sizes.cbBlockSize; 104 | wrapBufs[2].BufferType = SECBUFFER_PADDING; 105 | wrapBufs[2].pvBuffer = msg + sizes.cbSecurityTrailer + msgSize; 106 | 107 | status = call_sspi_encrypt_message(context, SECQOP_WRAP_NO_ENCRYPT, &wrapBufDesc, 0); 108 | if (status != SEC_E_OK) { 109 | free(msg); 110 | return status; 111 | } 112 | 113 | *buffer_length = wrapBufs[0].cbBuffer + wrapBufs[1].cbBuffer + wrapBufs[2].cbBuffer; 114 | *buffer = malloc(*buffer_length); 115 | 116 | memcpy(*buffer, wrapBufs[0].pvBuffer, wrapBufs[0].cbBuffer); 117 | memcpy(*buffer + wrapBufs[0].cbBuffer, wrapBufs[1].pvBuffer, wrapBufs[1].cbBuffer); 118 | memcpy(*buffer + wrapBufs[0].cbBuffer + wrapBufs[1].cbBuffer, wrapBufs[2].pvBuffer, wrapBufs[2].cbBuffer); 119 | 120 | free(msg); 121 | return SEC_E_OK; 122 | } 123 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.go: -------------------------------------------------------------------------------- 1 | package sasl 2 | 3 | // #include "sasl_windows.h" 4 | import "C" 5 | 6 | import ( 7 | "fmt" 8 | "strings" 9 | "sync" 10 | "unsafe" 11 | ) 12 | 13 | type saslStepper interface { 14 | Step(serverData []byte) (clientData []byte, done bool, err error) 15 | Close() 16 | } 17 | 18 | type saslSession struct { 19 | // Credentials 20 | mech string 21 | service string 22 | host string 23 | userPlusRealm string 24 | target string 25 | domain string 26 | 27 | // Internal state 28 | authComplete bool 29 | errored bool 30 | step int 31 | 32 | // C internal state 33 | credHandle C.CredHandle 34 | context C.CtxtHandle 35 | hasContext C.int 36 | 37 | // Keep track of pointers we need to explicitly free 38 | stringsToFree []*C.char 39 | } 40 | 41 | var initError error 42 | var initOnce sync.Once 43 | 44 | func initSSPI() { 45 | rc := C.load_secur32_dll() 46 | if rc != 0 { 47 | initError = fmt.Errorf("Error loading libraries: %v", rc) 48 | } 49 | } 50 | 51 | func New(username, password, mechanism, service, host string) (saslStepper, error) { 52 | initOnce.Do(initSSPI) 53 | ss := &saslSession{mech: mechanism, hasContext: 0, userPlusRealm: username} 54 | if service == "" { 55 | service = "mongodb" 56 | } 57 | if i := strings.Index(host, ":"); i >= 0 { 58 | host = host[:i] 59 | } 60 | ss.service = service 61 | ss.host = host 62 | 63 | usernameComponents := strings.Split(username, "@") 64 | if len(usernameComponents) < 2 { 65 | return nil, fmt.Errorf("Username '%v' doesn't contain a realm!", username) 66 | } 67 | user := usernameComponents[0] 68 | ss.domain = usernameComponents[1] 69 | ss.target = fmt.Sprintf("%s/%s", ss.service, ss.host) 70 | 71 | var status C.SECURITY_STATUS 72 | // Step 0: call AcquireCredentialsHandle to get a nice SSPI CredHandle 73 | if len(password) > 0 { 74 | status = C.sspi_acquire_credentials_handle(&ss.credHandle, ss.cstr(user), ss.cstr(password), ss.cstr(ss.domain)) 75 | } else { 76 | status = C.sspi_acquire_credentials_handle(&ss.credHandle, ss.cstr(user), nil, ss.cstr(ss.domain)) 77 | } 78 | if status != C.SEC_E_OK { 79 | ss.errored = true 80 | return nil, fmt.Errorf("Couldn't create new SSPI client, error code %v", status) 81 | } 82 | return ss, nil 83 | } 84 | 85 | func (ss *saslSession) cstr(s string) *C.char { 86 | cstr := C.CString(s) 87 | ss.stringsToFree = append(ss.stringsToFree, cstr) 88 | return cstr 89 | } 90 | 91 | func (ss *saslSession) Close() { 92 | for _, cstr := range ss.stringsToFree { 93 | C.free(unsafe.Pointer(cstr)) 94 | } 95 | } 96 | 97 | func (ss *saslSession) Step(serverData []byte) (clientData []byte, done bool, err error) { 98 | ss.step++ 99 | if ss.step > 10 { 100 | return nil, false, fmt.Errorf("too many SSPI steps without authentication") 101 | } 102 | var buffer C.PVOID 103 | var bufferLength C.ULONG 104 | var outBuffer C.PVOID 105 | var outBufferLength C.ULONG 106 | if len(serverData) > 0 { 107 | buffer = (C.PVOID)(unsafe.Pointer(&serverData[0])) 108 | bufferLength = C.ULONG(len(serverData)) 109 | } 110 | var status C.int 111 | if ss.authComplete { 112 | // Step 3: last bit of magic to use the correct server credentials 113 | status = C.sspi_send_client_authz_id(&ss.context, &outBuffer, &outBufferLength, ss.cstr(ss.userPlusRealm)) 114 | } else { 115 | // Step 1 + Step 2: set up security context with the server and TGT 116 | status = C.sspi_step(&ss.credHandle, ss.hasContext, &ss.context, buffer, bufferLength, &outBuffer, &outBufferLength, ss.cstr(ss.target)) 117 | } 118 | if outBuffer != C.PVOID(nil) { 119 | defer C.free(unsafe.Pointer(outBuffer)) 120 | } 121 | if status != C.SEC_E_OK && status != C.SEC_I_CONTINUE_NEEDED { 122 | ss.errored = true 123 | return nil, false, ss.handleSSPIErrorCode(status) 124 | } 125 | 126 | clientData = C.GoBytes(unsafe.Pointer(outBuffer), C.int(outBufferLength)) 127 | if status == C.SEC_E_OK { 128 | ss.authComplete = true 129 | return clientData, true, nil 130 | } else { 131 | ss.hasContext = 1 132 | return clientData, false, nil 133 | } 134 | } 135 | 136 | func (ss *saslSession) handleSSPIErrorCode(code C.int) error { 137 | switch { 138 | case code == C.SEC_E_TARGET_UNKNOWN: 139 | return fmt.Errorf("Target %v@%v not found", ss.target, ss.domain) 140 | } 141 | return fmt.Errorf("Unknown error doing step %v, error code %v", ss.step, code) 142 | } 143 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "sspi_windows.h" 4 | 5 | SECURITY_STATUS SEC_ENTRY sspi_acquire_credentials_handle(CredHandle* cred_handle, char* username, char* password, char* domain); 6 | int sspi_step(CredHandle* cred_handle, int has_context, CtxtHandle* context, PVOID buffer, ULONG buffer_length, PVOID* out_buffer, ULONG* out_buffer_length, char* target); 7 | int sspi_send_client_authz_id(CtxtHandle* context, PVOID* buffer, ULONG* buffer_length, char* user_plus_realm); 8 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/sasl/sspi_windows.c: -------------------------------------------------------------------------------- 1 | // Code adapted from the NodeJS kerberos library: 2 | // 3 | // https://github.com/christkv/kerberos/tree/master/lib/win32/kerberos_sspi.c 4 | // 5 | // Under the terms of the Apache License, Version 2.0: 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | #include 10 | 11 | #include "sspi_windows.h" 12 | 13 | static HINSTANCE sspi_secur32_dll = NULL; 14 | 15 | int load_secur32_dll() 16 | { 17 | sspi_secur32_dll = LoadLibrary("secur32.dll"); 18 | if (sspi_secur32_dll == NULL) { 19 | return GetLastError(); 20 | } 21 | return 0; 22 | } 23 | 24 | SECURITY_STATUS SEC_ENTRY call_sspi_encrypt_message(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo) 25 | { 26 | if (sspi_secur32_dll == NULL) { 27 | return -1; 28 | } 29 | encryptMessage_fn pfn_encryptMessage = (encryptMessage_fn) GetProcAddress(sspi_secur32_dll, "EncryptMessage"); 30 | if (!pfn_encryptMessage) { 31 | return -2; 32 | } 33 | return (*pfn_encryptMessage)(phContext, fQOP, pMessage, MessageSeqNo); 34 | } 35 | 36 | SECURITY_STATUS SEC_ENTRY call_sspi_acquire_credentials_handle( 37 | LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse, 38 | void *pvLogonId, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, 39 | PCredHandle phCredential, PTimeStamp ptsExpiry) 40 | { 41 | if (sspi_secur32_dll == NULL) { 42 | return -1; 43 | } 44 | acquireCredentialsHandle_fn pfn_acquireCredentialsHandle; 45 | #ifdef _UNICODE 46 | pfn_acquireCredentialsHandle = (acquireCredentialsHandle_fn) GetProcAddress(sspi_secur32_dll, "AcquireCredentialsHandleW"); 47 | #else 48 | pfn_acquireCredentialsHandle = (acquireCredentialsHandle_fn) GetProcAddress(sspi_secur32_dll, "AcquireCredentialsHandleA"); 49 | #endif 50 | if (!pfn_acquireCredentialsHandle) { 51 | return -2; 52 | } 53 | return (*pfn_acquireCredentialsHandle)( 54 | pszPrincipal, pszPackage, fCredentialUse, pvLogonId, pAuthData, 55 | pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry); 56 | } 57 | 58 | SECURITY_STATUS SEC_ENTRY call_sspi_initialize_security_context( 59 | PCredHandle phCredential, PCtxtHandle phContext, LPSTR pszTargetName, 60 | unsigned long fContextReq, unsigned long Reserved1, unsigned long TargetDataRep, 61 | PSecBufferDesc pInput, unsigned long Reserved2, PCtxtHandle phNewContext, 62 | PSecBufferDesc pOutput, unsigned long *pfContextAttr, PTimeStamp ptsExpiry) 63 | { 64 | if (sspi_secur32_dll == NULL) { 65 | return -1; 66 | } 67 | initializeSecurityContext_fn pfn_initializeSecurityContext; 68 | #ifdef _UNICODE 69 | pfn_initializeSecurityContext = (initializeSecurityContext_fn) GetProcAddress(sspi_secur32_dll, "InitializeSecurityContextW"); 70 | #else 71 | pfn_initializeSecurityContext = (initializeSecurityContext_fn) GetProcAddress(sspi_secur32_dll, "InitializeSecurityContextA"); 72 | #endif 73 | if (!pfn_initializeSecurityContext) { 74 | return -2; 75 | } 76 | return (*pfn_initializeSecurityContext)( 77 | phCredential, phContext, pszTargetName, fContextReq, Reserved1, TargetDataRep, 78 | pInput, Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry); 79 | } 80 | 81 | SECURITY_STATUS SEC_ENTRY call_sspi_query_context_attributes(PCtxtHandle phContext, unsigned long ulAttribute, void *pBuffer) 82 | { 83 | if (sspi_secur32_dll == NULL) { 84 | return -1; 85 | } 86 | queryContextAttributes_fn pfn_queryContextAttributes; 87 | #ifdef _UNICODE 88 | pfn_queryContextAttributes = (queryContextAttributes_fn) GetProcAddress(sspi_secur32_dll, "QueryContextAttributesW"); 89 | #else 90 | pfn_queryContextAttributes = (queryContextAttributes_fn) GetProcAddress(sspi_secur32_dll, "QueryContextAttributesA"); 91 | #endif 92 | if (!pfn_queryContextAttributes) { 93 | return -2; 94 | } 95 | return (*pfn_queryContextAttributes)(phContext, ulAttribute, pBuffer); 96 | } 97 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/internal/sasl/sspi_windows.h: -------------------------------------------------------------------------------- 1 | // Code adapted from the NodeJS kerberos library: 2 | // 3 | // https://github.com/christkv/kerberos/tree/master/lib/win32/kerberos_sspi.h 4 | // 5 | // Under the terms of the Apache License, Version 2.0: 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | #ifndef SSPI_WINDOWS_H 10 | #define SSPI_WINDOWS_H 11 | 12 | #define SECURITY_WIN32 1 13 | 14 | #include 15 | #include 16 | 17 | int load_secur32_dll(); 18 | 19 | SECURITY_STATUS SEC_ENTRY call_sspi_encrypt_message(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo); 20 | 21 | typedef DWORD (WINAPI *encryptMessage_fn)(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo); 22 | 23 | SECURITY_STATUS SEC_ENTRY call_sspi_acquire_credentials_handle( 24 | LPSTR pszPrincipal, // Name of principal 25 | LPSTR pszPackage, // Name of package 26 | unsigned long fCredentialUse, // Flags indicating use 27 | void *pvLogonId, // Pointer to logon ID 28 | void *pAuthData, // Package specific data 29 | SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func 30 | void *pvGetKeyArgument, // Value to pass to GetKey() 31 | PCredHandle phCredential, // (out) Cred Handle 32 | PTimeStamp ptsExpiry // (out) Lifetime (optional) 33 | ); 34 | 35 | typedef DWORD (WINAPI *acquireCredentialsHandle_fn)( 36 | LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse, 37 | void *pvLogonId, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, 38 | PCredHandle phCredential, PTimeStamp ptsExpiry 39 | ); 40 | 41 | SECURITY_STATUS SEC_ENTRY call_sspi_initialize_security_context( 42 | PCredHandle phCredential, // Cred to base context 43 | PCtxtHandle phContext, // Existing context (OPT) 44 | LPSTR pszTargetName, // Name of target 45 | unsigned long fContextReq, // Context Requirements 46 | unsigned long Reserved1, // Reserved, MBZ 47 | unsigned long TargetDataRep, // Data rep of target 48 | PSecBufferDesc pInput, // Input Buffers 49 | unsigned long Reserved2, // Reserved, MBZ 50 | PCtxtHandle phNewContext, // (out) New Context handle 51 | PSecBufferDesc pOutput, // (inout) Output Buffers 52 | unsigned long *pfContextAttr, // (out) Context attrs 53 | PTimeStamp ptsExpiry // (out) Life span (OPT) 54 | ); 55 | 56 | typedef DWORD (WINAPI *initializeSecurityContext_fn)( 57 | PCredHandle phCredential, PCtxtHandle phContext, LPSTR pszTargetName, unsigned long fContextReq, 58 | unsigned long Reserved1, unsigned long TargetDataRep, PSecBufferDesc pInput, unsigned long Reserved2, 59 | PCtxtHandle phNewContext, PSecBufferDesc pOutput, unsigned long *pfContextAttr, PTimeStamp ptsExpiry); 60 | 61 | SECURITY_STATUS SEC_ENTRY call_sspi_query_context_attributes( 62 | PCtxtHandle phContext, // Context to query 63 | unsigned long ulAttribute, // Attribute to query 64 | void *pBuffer // Buffer for attributes 65 | ); 66 | 67 | typedef DWORD (WINAPI *queryContextAttributes_fn)( 68 | PCtxtHandle phContext, unsigned long ulAttribute, void *pBuffer); 69 | 70 | #endif // SSPI_WINDOWS_H 71 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/log.go: -------------------------------------------------------------------------------- 1 | // mgo - MongoDB driver for Go 2 | // 3 | // Copyright (c) 2010-2012 - Gustavo Niemeyer 4 | // 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // 1. Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // 2. Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package mgo 28 | 29 | import ( 30 | "fmt" 31 | "sync" 32 | ) 33 | 34 | // --------------------------------------------------------------------------- 35 | // Logging integration. 36 | 37 | // Avoid importing the log type information unnecessarily. There's a small cost 38 | // associated with using an interface rather than the type. Depending on how 39 | // often the logger is plugged in, it would be worth using the type instead. 40 | type log_Logger interface { 41 | Output(calldepth int, s string) error 42 | } 43 | 44 | var ( 45 | globalLogger log_Logger 46 | globalDebug bool 47 | globalMutex sync.Mutex 48 | ) 49 | 50 | // RACE WARNING: There are known data races when logging, which are manually 51 | // silenced when the race detector is in use. These data races won't be 52 | // observed in typical use, because logging is supposed to be set up once when 53 | // the application starts. Having raceDetector as a constant, the compiler 54 | // should elide the locks altogether in actual use. 55 | 56 | // Specify the *log.Logger object where log messages should be sent to. 57 | func SetLogger(logger log_Logger) { 58 | if raceDetector { 59 | globalMutex.Lock() 60 | defer globalMutex.Unlock() 61 | } 62 | globalLogger = logger 63 | } 64 | 65 | // Enable the delivery of debug messages to the logger. Only meaningful 66 | // if a logger is also set. 67 | func SetDebug(debug bool) { 68 | if raceDetector { 69 | globalMutex.Lock() 70 | defer globalMutex.Unlock() 71 | } 72 | globalDebug = debug 73 | } 74 | 75 | func log(v ...interface{}) { 76 | if raceDetector { 77 | globalMutex.Lock() 78 | defer globalMutex.Unlock() 79 | } 80 | if globalLogger != nil { 81 | globalLogger.Output(2, fmt.Sprint(v...)) 82 | } 83 | } 84 | 85 | func logln(v ...interface{}) { 86 | if raceDetector { 87 | globalMutex.Lock() 88 | defer globalMutex.Unlock() 89 | } 90 | if globalLogger != nil { 91 | globalLogger.Output(2, fmt.Sprintln(v...)) 92 | } 93 | } 94 | 95 | func logf(format string, v ...interface{}) { 96 | if raceDetector { 97 | globalMutex.Lock() 98 | defer globalMutex.Unlock() 99 | } 100 | if globalLogger != nil { 101 | globalLogger.Output(2, fmt.Sprintf(format, v...)) 102 | } 103 | } 104 | 105 | func debug(v ...interface{}) { 106 | if raceDetector { 107 | globalMutex.Lock() 108 | defer globalMutex.Unlock() 109 | } 110 | if globalDebug && globalLogger != nil { 111 | globalLogger.Output(2, fmt.Sprint(v...)) 112 | } 113 | } 114 | 115 | func debugln(v ...interface{}) { 116 | if raceDetector { 117 | globalMutex.Lock() 118 | defer globalMutex.Unlock() 119 | } 120 | if globalDebug && globalLogger != nil { 121 | globalLogger.Output(2, fmt.Sprintln(v...)) 122 | } 123 | } 124 | 125 | func debugf(format string, v ...interface{}) { 126 | if raceDetector { 127 | globalMutex.Lock() 128 | defer globalMutex.Unlock() 129 | } 130 | if globalDebug && globalLogger != nil { 131 | globalLogger.Output(2, fmt.Sprintf(format, v...)) 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/queue.go: -------------------------------------------------------------------------------- 1 | // mgo - MongoDB driver for Go 2 | // 3 | // Copyright (c) 2010-2012 - Gustavo Niemeyer 4 | // 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // 1. Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // 2. Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package mgo 28 | 29 | type queue struct { 30 | elems []interface{} 31 | nelems, popi, pushi int 32 | } 33 | 34 | func (q *queue) Len() int { 35 | return q.nelems 36 | } 37 | 38 | func (q *queue) Push(elem interface{}) { 39 | //debugf("Pushing(pushi=%d popi=%d cap=%d): %#v\n", 40 | // q.pushi, q.popi, len(q.elems), elem) 41 | if q.nelems == len(q.elems) { 42 | q.expand() 43 | } 44 | q.elems[q.pushi] = elem 45 | q.nelems++ 46 | q.pushi = (q.pushi + 1) % len(q.elems) 47 | //debugf(" Pushed(pushi=%d popi=%d cap=%d): %#v\n", 48 | // q.pushi, q.popi, len(q.elems), elem) 49 | } 50 | 51 | func (q *queue) Pop() (elem interface{}) { 52 | //debugf("Popping(pushi=%d popi=%d cap=%d)\n", 53 | // q.pushi, q.popi, len(q.elems)) 54 | if q.nelems == 0 { 55 | return nil 56 | } 57 | elem = q.elems[q.popi] 58 | q.elems[q.popi] = nil // Help GC. 59 | q.nelems-- 60 | q.popi = (q.popi + 1) % len(q.elems) 61 | //debugf(" Popped(pushi=%d popi=%d cap=%d): %#v\n", 62 | // q.pushi, q.popi, len(q.elems), elem) 63 | return elem 64 | } 65 | 66 | func (q *queue) expand() { 67 | curcap := len(q.elems) 68 | var newcap int 69 | if curcap == 0 { 70 | newcap = 8 71 | } else if curcap < 1024 { 72 | newcap = curcap * 2 73 | } else { 74 | newcap = curcap + (curcap / 4) 75 | } 76 | elems := make([]interface{}, newcap) 77 | 78 | if q.popi == 0 { 79 | copy(elems, q.elems) 80 | q.pushi = curcap 81 | } else { 82 | newpopi := newcap - (curcap - q.popi) 83 | copy(elems, q.elems[:q.popi]) 84 | copy(elems[newpopi:], q.elems[q.popi:]) 85 | q.popi = newpopi 86 | } 87 | for i := range q.elems { 88 | q.elems[i] = nil // Help GC. 89 | } 90 | q.elems = elems 91 | } 92 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/raceoff.go: -------------------------------------------------------------------------------- 1 | // +build !race 2 | 3 | package mgo 4 | 5 | const raceDetector = false 6 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/raceon.go: -------------------------------------------------------------------------------- 1 | // +build race 2 | 3 | package mgo 4 | 5 | const raceDetector = true 6 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/saslimpl.go: -------------------------------------------------------------------------------- 1 | //+build sasl 2 | 3 | package mgo 4 | 5 | import ( 6 | "gopkg.in/mgo.v2/internal/sasl" 7 | ) 8 | 9 | func saslNew(cred Credential, host string) (saslStepper, error) { 10 | return sasl.New(cred.Username, cred.Password, cred.Mechanism, cred.Service, host) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/saslstub.go: -------------------------------------------------------------------------------- 1 | //+build !sasl 2 | 3 | package mgo 4 | 5 | import ( 6 | "fmt" 7 | ) 8 | 9 | func saslNew(cred Credential, host string) (saslStepper, error) { 10 | return nil, fmt.Errorf("SASL support not enabled during build (-tags sasl)") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/gopkg.in/mgo.v2/stats.go: -------------------------------------------------------------------------------- 1 | // mgo - MongoDB driver for Go 2 | // 3 | // Copyright (c) 2010-2012 - Gustavo Niemeyer 4 | // 5 | // All rights reserved. 6 | // 7 | // Redistribution and use in source and binary forms, with or without 8 | // modification, are permitted provided that the following conditions are met: 9 | // 10 | // 1. Redistributions of source code must retain the above copyright notice, this 11 | // list of conditions and the following disclaimer. 12 | // 2. Redistributions in binary form must reproduce the above copyright notice, 13 | // this list of conditions and the following disclaimer in the documentation 14 | // and/or other materials provided with the distribution. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package mgo 28 | 29 | import ( 30 | "sync" 31 | ) 32 | 33 | var stats *Stats 34 | var statsMutex sync.Mutex 35 | 36 | func SetStats(enabled bool) { 37 | statsMutex.Lock() 38 | if enabled { 39 | if stats == nil { 40 | stats = &Stats{} 41 | } 42 | } else { 43 | stats = nil 44 | } 45 | statsMutex.Unlock() 46 | } 47 | 48 | func GetStats() (snapshot Stats) { 49 | statsMutex.Lock() 50 | snapshot = *stats 51 | statsMutex.Unlock() 52 | return 53 | } 54 | 55 | func ResetStats() { 56 | statsMutex.Lock() 57 | debug("Resetting stats") 58 | old := stats 59 | stats = &Stats{} 60 | // These are absolute values: 61 | stats.Clusters = old.Clusters 62 | stats.SocketsInUse = old.SocketsInUse 63 | stats.SocketsAlive = old.SocketsAlive 64 | stats.SocketRefs = old.SocketRefs 65 | statsMutex.Unlock() 66 | return 67 | } 68 | 69 | type Stats struct { 70 | Clusters int 71 | MasterConns int 72 | SlaveConns int 73 | SentOps int 74 | ReceivedOps int 75 | ReceivedDocs int 76 | SocketsAlive int 77 | SocketsInUse int 78 | SocketRefs int 79 | } 80 | 81 | func (stats *Stats) cluster(delta int) { 82 | if stats != nil { 83 | statsMutex.Lock() 84 | stats.Clusters += delta 85 | statsMutex.Unlock() 86 | } 87 | } 88 | 89 | func (stats *Stats) conn(delta int, master bool) { 90 | if stats != nil { 91 | statsMutex.Lock() 92 | if master { 93 | stats.MasterConns += delta 94 | } else { 95 | stats.SlaveConns += delta 96 | } 97 | statsMutex.Unlock() 98 | } 99 | } 100 | 101 | func (stats *Stats) sentOps(delta int) { 102 | if stats != nil { 103 | statsMutex.Lock() 104 | stats.SentOps += delta 105 | statsMutex.Unlock() 106 | } 107 | } 108 | 109 | func (stats *Stats) receivedOps(delta int) { 110 | if stats != nil { 111 | statsMutex.Lock() 112 | stats.ReceivedOps += delta 113 | statsMutex.Unlock() 114 | } 115 | } 116 | 117 | func (stats *Stats) receivedDocs(delta int) { 118 | if stats != nil { 119 | statsMutex.Lock() 120 | stats.ReceivedDocs += delta 121 | statsMutex.Unlock() 122 | } 123 | } 124 | 125 | func (stats *Stats) socketsInUse(delta int) { 126 | if stats != nil { 127 | statsMutex.Lock() 128 | stats.SocketsInUse += delta 129 | statsMutex.Unlock() 130 | } 131 | } 132 | 133 | func (stats *Stats) socketsAlive(delta int) { 134 | if stats != nil { 135 | statsMutex.Lock() 136 | stats.SocketsAlive += delta 137 | statsMutex.Unlock() 138 | } 139 | } 140 | 141 | func (stats *Stats) socketRefs(delta int) { 142 | if stats != nil { 143 | statsMutex.Lock() 144 | stats.SocketRefs += delta 145 | statsMutex.Unlock() 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /vendor/gopkg.in/robfig/cron.v2/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/robfig/cron.v2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | -------------------------------------------------------------------------------- /vendor/gopkg.in/robfig/cron.v2/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Rob Figueiredo 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/gopkg.in/robfig/cron.v2/README.md: -------------------------------------------------------------------------------- 1 | [![GoDoc](http://godoc.org/github.com/robfig/cron?status.png)](http://godoc.org/github.com/robfig/cron) 2 | -------------------------------------------------------------------------------- /vendor/gopkg.in/robfig/cron.v2/constantdelay.go: -------------------------------------------------------------------------------- 1 | package cron 2 | 3 | import "time" 4 | 5 | // ConstantDelaySchedule represents a simple recurring duty cycle, e.g. "Every 5 minutes". 6 | // It does not support jobs more frequent than once a second. 7 | type ConstantDelaySchedule struct { 8 | Delay time.Duration 9 | } 10 | 11 | // Every returns a crontab Schedule that activates once every duration. 12 | // Delays of less than a second are not supported (will round up to 1 second). 13 | // Any fields less than a Second are truncated. 14 | func Every(duration time.Duration) ConstantDelaySchedule { 15 | if duration < time.Second { 16 | duration = time.Second 17 | } 18 | return ConstantDelaySchedule{ 19 | Delay: duration - time.Duration(duration.Nanoseconds())%time.Second, 20 | } 21 | } 22 | 23 | // Next returns the next time this should be run. 24 | // This rounds so that the next activation time will be on the second. 25 | func (schedule ConstantDelaySchedule) Next(t time.Time) time.Time { 26 | return t.Add(schedule.Delay - time.Duration(t.Nanosecond())*time.Nanosecond) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/gopkg.in/robfig/cron.v2/spec.go: -------------------------------------------------------------------------------- 1 | package cron 2 | 3 | import "time" 4 | 5 | // SpecSchedule specifies a duty cycle (to the second granularity), based on a 6 | // traditional crontab specification. It is computed initially and stored as bit sets. 7 | type SpecSchedule struct { 8 | Second, Minute, Hour, Dom, Month, Dow uint64 9 | Location *time.Location 10 | } 11 | 12 | // bounds provides a range of acceptable values (plus a map of name to value). 13 | type bounds struct { 14 | min, max uint 15 | names map[string]uint 16 | } 17 | 18 | // The bounds for each field. 19 | var ( 20 | seconds = bounds{0, 59, nil} 21 | minutes = bounds{0, 59, nil} 22 | hours = bounds{0, 23, nil} 23 | dom = bounds{1, 31, nil} 24 | months = bounds{1, 12, map[string]uint{ 25 | "jan": 1, 26 | "feb": 2, 27 | "mar": 3, 28 | "apr": 4, 29 | "may": 5, 30 | "jun": 6, 31 | "jul": 7, 32 | "aug": 8, 33 | "sep": 9, 34 | "oct": 10, 35 | "nov": 11, 36 | "dec": 12, 37 | }} 38 | dow = bounds{0, 6, map[string]uint{ 39 | "sun": 0, 40 | "mon": 1, 41 | "tue": 2, 42 | "wed": 3, 43 | "thu": 4, 44 | "fri": 5, 45 | "sat": 6, 46 | }} 47 | ) 48 | 49 | const ( 50 | // Set the top bit if a star was included in the expression. 51 | starBit = 1 << 63 52 | ) 53 | 54 | // Next returns the next time this schedule is activated, greater than the given 55 | // time. If no time can be found to satisfy the schedule, return the zero time. 56 | func (s *SpecSchedule) Next(t time.Time) time.Time { 57 | // General approach: 58 | // For Month, Day, Hour, Minute, Second: 59 | // Check if the time value matches. If yes, continue to the next field. 60 | // If the field doesn't match the schedule, then increment the field until it matches. 61 | // While incrementing the field, a wrap-around brings it back to the beginning 62 | // of the field list (since it is necessary to re-verify previous field 63 | // values) 64 | 65 | // Convert the given time into the schedule's timezone. 66 | // Save the original timezone so we can convert back after we find a time. 67 | origLocation := t.Location() 68 | t = t.In(s.Location) 69 | 70 | // Start at the earliest possible time (the upcoming second). 71 | t = t.Add(1*time.Second - time.Duration(t.Nanosecond())*time.Nanosecond) 72 | 73 | // This flag indicates whether a field has been incremented. 74 | added := false 75 | 76 | // If no time is found within five years, return zero. 77 | yearLimit := t.Year() + 5 78 | 79 | WRAP: 80 | if t.Year() > yearLimit { 81 | return time.Time{} 82 | } 83 | 84 | // Find the first applicable month. 85 | // If it's this month, then do nothing. 86 | for 1< 0 158 | dowMatch bool = 1< 0 159 | ) 160 | 161 | if s.Dom&starBit > 0 || s.Dow&starBit > 0 { 162 | return domMatch && dowMatch 163 | } 164 | return domMatch || dowMatch 165 | } 166 | -------------------------------------------------------------------------------- /website/inc/css/bootstrap-tokenfield.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * bootstrap-tokenfield 3 | * https://github.com/sliptree/bootstrap-tokenfield 4 | * Copyright 2013-2014 Sliptree and other contributors; Licensed MIT 5 | */@-webkit-keyframes blink{0%{border-color:#ededed}100%{border-color:#b94a48}}@-moz-keyframes blink{0%{border-color:#ededed}100%{border-color:#b94a48}}@keyframes blink{0%{border-color:#ededed}100%{border-color:#b94a48}}.tokenfield{height:auto;min-height:34px;padding-bottom:0}.tokenfield.focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.tokenfield .token{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;display:inline-block;border:1px solid #d9d9d9;background-color:#ededed;white-space:nowrap;margin:-1px 5px 5px 0;height:22px;vertical-align:top;cursor:default}.tokenfield .token:hover{border-color:#b9b9b9}.tokenfield .token.active{border-color:#52a8ec;border-color:rgba(82,168,236,.8)}.tokenfield .token.duplicate{border-color:#ebccd1;-webkit-animation-name:blink;animation-name:blink;-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-timing-function:ease;animation-timing-function:ease;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.tokenfield .token.invalid{background:0 0;border:1px solid transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;border-bottom:1px dotted #d9534f}.tokenfield .token.invalid.active{background:#ededed;border:1px solid #ededed;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.tokenfield .token .token-label{display:inline-block;overflow:hidden;text-overflow:ellipsis;padding-left:4px;vertical-align:top}.tokenfield .token .close{font-family:Arial;display:inline-block;line-height:100%;font-size:1.1em;line-height:1.49em;margin-left:5px;float:none;height:100%;vertical-align:top;padding-right:4px}.tokenfield .token-input{background:0 0;width:60px;min-width:60px;border:0;height:20px;padding:0;margin-bottom:6px;-webkit-box-shadow:none;box-shadow:none}.tokenfield .token-input:focus{border-color:transparent;outline:0;-webkit-box-shadow:none;box-shadow:none}.tokenfield.disabled{cursor:not-allowed;background-color:#eee}.tokenfield.disabled .token-input{cursor:not-allowed}.tokenfield.disabled .token:hover{cursor:not-allowed;border-color:#d9d9d9}.tokenfield.disabled .token:hover .close{cursor:not-allowed;opacity:.2;filter:alpha(opacity=20)}.has-warning .tokenfield.focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-error .tokenfield.focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-success .tokenfield.focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.tokenfield.input-sm,.input-group-sm .tokenfield{min-height:30px;padding-bottom:0}.input-group-sm .token,.tokenfield.input-sm .token{height:20px;margin-bottom:4px}.input-group-sm .token-input,.tokenfield.input-sm .token-input{height:18px;margin-bottom:5px}.tokenfield.input-lg,.input-group-lg .tokenfield{height:auto;min-height:45px;padding-bottom:4px}.input-group-lg .token,.tokenfield.input-lg .token{height:25px}.input-group-lg .token-label,.tokenfield.input-lg .token-label{line-height:23px}.input-group-lg .token .close,.tokenfield.input-lg .token .close{line-height:1.3em}.input-group-lg .token-input,.tokenfield.input-lg .token-input{height:23px;line-height:23px;margin-bottom:6px;vertical-align:top}.tokenfield.rtl{direction:rtl;text-align:right}.tokenfield.rtl .token{margin:-1px 0 5px 5px}.tokenfield.rtl .token .token-label{padding-left:0;padding-right:4px} -------------------------------------------------------------------------------- /website/inc/css/dragula.min.css: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright © 2015-2016 Nicolas Bevacqua 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | .gu-mirror{position:fixed!important;margin:0!important;z-index:9999!important;opacity:.8;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";filter:alpha(opacity=80)}.gu-hide{display:none!important}.gu-unselectable{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.gu-transit{opacity:.2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";filter:alpha(opacity=20)} 24 | -------------------------------------------------------------------------------- /website/inc/css/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/css/jquery.dynatable.css: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Dynatable plugin 0.3.1 3 | * 4 | * Copyright (c) 2014 Steve Schwartz (JangoSteve) 5 | * 6 | * Dual licensed under the AGPL and Proprietary licenses: 7 | * http://www.dynatable.com/license/ 8 | * 9 | * Date: Tue Jan 02 2014 10 | */ 11 | th a { 12 | color: #fff; 13 | } 14 | th a:hover { 15 | color: #fff; 16 | text-decoration: underline; 17 | } 18 | 19 | .dynatable-search { 20 | float: right; 21 | margin-bottom: 10px; 22 | } 23 | 24 | .dynatable-pagination-links { 25 | float: right; 26 | } 27 | 28 | .dynatable-record-count { 29 | display: block; 30 | padding: 5px 0; 31 | } 32 | 33 | .dynatable-pagination-links span, 34 | .dynatable-pagination-links li { 35 | display: inline-block; 36 | } 37 | 38 | .dynatable-page-link, 39 | .dynatable-page-break { 40 | display: block; 41 | padding: 5px 7px; 42 | } 43 | 44 | .dynatable-page-link { 45 | cursor: pointer; 46 | } 47 | 48 | .dynatable-active-page, 49 | .dynatable-disabled-page { 50 | cursor: text; 51 | } 52 | .dynatable-active-page:hover, 53 | .dynatable-disabled-page:hover { 54 | text-decoration: none; 55 | } 56 | 57 | .dynatable-active-page { 58 | background: #71AF5A; 59 | border-radius: 5px; 60 | color: #fff; 61 | } 62 | .dynatable-active-page:hover { 63 | color: #fff; 64 | } 65 | .dynatable-disabled-page, 66 | .dynatable-disabled-page:hover { 67 | background: none; 68 | color: #999; 69 | } 70 | -------------------------------------------------------------------------------- /website/inc/css/simple-sidebar.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - Simple Sidebar (http://startbootstrap.com/) 3 | * Copyright 2013-2016 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) 5 | */ 6 | 7 | /* MY CUSTOM CSS */ 8 | #site-title { 9 | font-weight: bold; 10 | font-size: 24px; 11 | color: white; 12 | letter-spacing: 7px; 13 | } 14 | 15 | .chart-container { 16 | height: 500px; 17 | } 18 | 19 | /* END CUSTOM CSS */ 20 | 21 | body { 22 | overflow-x: hidden; 23 | } 24 | 25 | /* Toggle Styles */ 26 | 27 | #wrapper { 28 | padding-left: 0; 29 | -webkit-transition: all 0.5s ease; 30 | -moz-transition: all 0.5s ease; 31 | -o-transition: all 0.5s ease; 32 | transition: all 0.5s ease; 33 | } 34 | 35 | #wrapper.toggled { 36 | padding-left: 250px; 37 | } 38 | 39 | #sidebar-wrapper { 40 | z-index: 1000; 41 | position: fixed; 42 | left: 250px; 43 | width: 0; 44 | height: 100%; 45 | margin-left: -250px; 46 | overflow-y: auto; 47 | background: #000; 48 | -webkit-transition: all 0.5s ease; 49 | -moz-transition: all 0.5s ease; 50 | -o-transition: all 0.5s ease; 51 | transition: all 0.5s ease; 52 | } 53 | 54 | #wrapper.toggled #sidebar-wrapper { 55 | width: 250px; 56 | } 57 | 58 | #page-content-wrapper { 59 | width: 100%; 60 | position: absolute; 61 | padding: 15px; 62 | } 63 | 64 | #wrapper.toggled #page-content-wrapper { 65 | position: absolute; 66 | margin-right: -250px; 67 | } 68 | 69 | /* Sidebar Styles */ 70 | 71 | .sidebar-nav { 72 | position: absolute; 73 | top: 0; 74 | width: 250px; 75 | margin: 0; 76 | padding: 0; 77 | list-style: none; 78 | } 79 | 80 | .sidebar-nav li { 81 | text-indent: 20px; 82 | line-height: 40px; 83 | } 84 | 85 | .sidebar-nav li a { 86 | display: block; 87 | text-decoration: none; 88 | color: #999999; 89 | } 90 | 91 | .sidebar-nav li a:hover { 92 | text-decoration: none; 93 | color: #fff; 94 | background: rgba(255,255,255,0.2); 95 | } 96 | 97 | .sidebar-nav li a:active, 98 | .sidebar-nav li a:focus { 99 | text-decoration: none; 100 | } 101 | 102 | .sidebar-nav > .sidebar-brand { 103 | height: 65px; 104 | font-size: 18px; 105 | line-height: 60px; 106 | } 107 | 108 | .sidebar-nav > .sidebar-brand a { 109 | color: #999999; 110 | } 111 | 112 | .sidebar-nav > .sidebar-brand a:hover { 113 | color: #fff; 114 | background: none; 115 | } 116 | 117 | @media(min-width:768px) { 118 | #wrapper { 119 | padding-left: 250px; 120 | } 121 | 122 | #wrapper.toggled { 123 | padding-left: 0; 124 | } 125 | 126 | #sidebar-wrapper { 127 | width: 250px; 128 | } 129 | 130 | #wrapper.toggled #sidebar-wrapper { 131 | width: 0; 132 | } 133 | 134 | #page-content-wrapper { 135 | padding: 20px; 136 | position: relative; 137 | } 138 | 139 | #wrapper.toggled #page-content-wrapper { 140 | position: relative; 141 | margin-right: 0; 142 | } 143 | } -------------------------------------------------------------------------------- /website/inc/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/website/inc/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /website/inc/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/website/inc/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /website/inc/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/website/inc/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /website/inc/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciscocsirt/GOSINT/53cef4e428e2f45820a1b8ef1d8a03df7eacf59d/website/inc/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /website/inc/fonts/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/img/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/adHoc/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/dataTables/dataTables-plugins.js: -------------------------------------------------------------------------------- 1 | /*! CellEdit 1.0.19 2 | * ©2016 Elliott Beaty - datatables.net/license 3 | */ 4 | 5 | /** 6 | * @summary CellEdit 7 | * @description Make a cell editable when clicked upon 8 | * @version 1.0.19 9 | * @file dataTables.editCell.js 10 | * @author Elliott Beaty 11 | * @contact elliott@elliottbeaty.com 12 | * @copyright Copyright 2016 Elliott Beaty 13 | * 14 | * This source file is free software, available under the following license: 15 | * MIT license - http://datatables.net/license/mit 16 | * 17 | * This source file is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 19 | * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. 20 | * 21 | * For details please refer to: http://www.datatables.net 22 | */ 23 | function getInputHtml(a,b,c){var d,e,f,g,h,i;switch(f={focus:!0,html:null},b.inputTypes&&$.each(b.inputTypes,function(b,c){c.column==a&&(d=c,e=d.type.toLowerCase())}),b.inputCss&&(g=b.inputCss),b.confirmationButton&&(h=b.confirmationButton.confirmCss,i=b.confirmationButton.cancelCss,e+="-confirm"),e){case"list":f.html="",f.focus=!1;break;case"list-confirm":f.html=" Confirm Cancel ",f.focus=!1;break;case"datepicker":case"datepicker-confirm":if(void 0===jQuery.ui){alert("jQuery UI is required for the DatePicker control but it is not loaded on the page!");break}jQuery(".datepick").datepicker("destroy"),f.html="  Confirm Cancel",setTimeout(function(){var a="http://jqueryui.com/resources/demos/datepicker/images/calendar.gif";void 0!==d.options&&void 0!==d.options.icon&&(a=d.options.icon);jQuery(".datepick").datepicker({showOn:"button",buttonImage:a,buttonImageOnly:!0,buttonText:"Select date"})},100);break;case"text-confirm":case"undefined-confirm":f.html=" Confirm Cancel ";break;default:f.html=""}return f}function getInputField(a){var b;switch($(a).prop("nodeName").toLowerCase()){case"a":$(a).siblings("input").length>0&&(b=$(a).siblings("input")),$(a).siblings("select").length>0&&(b=$(a).siblings("select"));break;default:b=$(a)}return b}function sanitizeCellValue(a){return void 0===a||null===a||a.length<1?"":(isNaN(a)&&(a=a.replace(/'/g,"'")),a)}jQuery.extend(jQuery.fn.dataTableExt.oSort,{"moment-js-date-pre":function(a){return moment(a,"ddd DD MMM YYYY HH:mm:ss UTC").unix()},"moment-js-date-asc":function(a,b){return a-b},"moment-js-date-desc":function(a,b){return b-a}}),jQuery.fn.dataTable.Api.register("MakeCellsEditable()",function(a){var b=this.table();jQuery.fn.extend({updateEditableCell:function(b){function i(){a.allowNulls.errorClass?$(g).addClass(a.allowNulls.errorClass):$(g).css({border:"red solid 1px"})}function j(b){var c=e.data();e.data(b),a.onUpdate(e,d,c)}var c=$(b.closest("table")).DataTable().table(),d=c.row($(b).parents("tr")),e=c.cell($(b).parent()),f=e.index().column,g=getInputField(b),h=g.val();!h&&a.allowNulls&&1!=a.allowNulls?a.allowNulls.columns?a.allowNulls.columns.indexOf(f)>-1?j(h):i():h||i():j(h);var k=c.page.info().page;c.page(k).draw(!1)},cancelEditableCell:function(a){var b=$(a.closest("table")).DataTable().table(),c=b.cell($(a).parent());c.data(c.data()),b.draw()}}),"destroy"===a&&($(b.body()).off("click","td"),b=null),null!=b&&$(b.body()).on("click","td",function(){var c=b.cell(this).index().column;if(a.columns&&a.columns.indexOf(c)>-1||!a.columns){var d=b.row($(this).parents("tr"));editableCellsRow=d;var e=b.cell(this).node(),f=b.cell(this).data();if(f=sanitizeCellValue(f),!$(e).find("input").length&&!$(e).find("select").length){var g=getInputHtml(c,a,f);$(e).html(g.html),g.focus&&$("#ejbeatycelledit").focus()}}})}); 24 | -------------------------------------------------------------------------------- /website/inc/js/dataTables/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/general/generate.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Function Name: generate 3 | * Pre-Condition: Type is one of (success, information, error, warning) 4 | * Post-Condition: Display notification on front end with specified config 5 | */ 6 | function generate(type, text) { 7 | 8 | var n = noty({ 9 | text : text, 10 | type : type, 11 | dismissQueue: true, 12 | layout : 'topRight', 13 | closeWith : ['click'], 14 | theme : 'relax', 15 | timeout : 3000, 16 | maxVisible : 10, 17 | animation : { 18 | open : 'animated bounceInRight', 19 | close : 'animated bounceOutRight', 20 | easing: 'swing', 21 | speed : 500 22 | } 23 | }); 24 | } 25 | 26 | /* 27 | * Function Name: AJAXerrorHandler 28 | * Pre-Condition: Some functionality on our site has triggered this error 29 | * Post-Condition: Display error notification and hide loading (for pre-processing and ad-hoc) 30 | */ 31 | function AJAXerrorHandler (request, status, error) { 32 | generate("error", "Error in making AJAX request. Check console for details."); 33 | console.log(request); 34 | console.log(status); 35 | console.log(error); 36 | $(".oloading").hide(); 37 | $(".tloading").hide(); 38 | $(".vloading").hide(); 39 | $(".ahloading").hide(); 40 | } 41 | 42 | // Set BASEURL for API calls 43 | 44 | // Prod 45 | 46 | var BASEURL = window.location.protocol + "//" + window.location.hostname; 47 | 48 | // Does GOSINT run on a port? 49 | var port = window.location.port; 50 | if (port !== "") { 51 | BASEURL += ":" + port; 52 | } 53 | 54 | // Is GOSINT being run in a directory? 55 | var path = window.location.pathname; 56 | var dir = path.substring(0, path.lastIndexOf('/')); 57 | if (dir !== "") { 58 | BASEURL += dir; 59 | } 60 | 61 | BASEURL += "/api"; 62 | -------------------------------------------------------------------------------- /website/inc/js/general/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/general/jquery.modal.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | A simple jQuery modal (http://github.com/kylefox/jquery-modal) 3 | Version 0.8.0 4 | */ 5 | !function(o){"object"==typeof module&&"object"==typeof module.exports?o(require("jquery"),window,document):o(jQuery,window,document)}(function(o,t,e,i){var s=[],l=function(){return s.length?s[s.length-1]:null},n=function(){var o,t=!1;for(o=s.length-1;o>=0;o--)s[o].$blocker&&(s[o].$blocker.toggleClass("current",!t).toggleClass("behind",t),t=!0)};o.modal=function(t,e){var i,n;if(this.$body=o("body"),this.options=o.extend({},o.modal.defaults,e),this.options.doFade=!isNaN(parseInt(this.options.fadeDuration,10)),this.$blocker=null,this.options.closeExisting)for(;o.modal.isActive();)o.modal.close();if(s.push(this),t.is("a"))if(n=t.attr("href"),/^#/.test(n)){if(this.$elm=o(n),1!==this.$elm.length)return null;this.$body.append(this.$elm),this.open()}else this.$elm=o("
"),this.$body.append(this.$elm),i=function(o,t){t.elm.remove()},this.showSpinner(),t.trigger(o.modal.AJAX_SEND),o.get(n).done(function(e){if(o.modal.isActive()){t.trigger(o.modal.AJAX_SUCCESS);var s=l();s.$elm.empty().append(e).on(o.modal.CLOSE,i),s.hideSpinner(),s.open(),t.trigger(o.modal.AJAX_COMPLETE)}}).fail(function(){t.trigger(o.modal.AJAX_FAIL);var e=l();e.hideSpinner(),s.pop(),t.trigger(o.modal.AJAX_COMPLETE)});else this.$elm=t,this.$body.append(this.$elm),this.open()},o.modal.prototype={constructor:o.modal,open:function(){var t=this;this.block(),this.options.doFade?setTimeout(function(){t.show()},this.options.fadeDuration*this.options.fadeDelay):this.show(),o(e).off("keydown.modal").on("keydown.modal",function(o){var t=l();27==o.which&&t.options.escapeClose&&t.close()}),this.options.clickClose&&this.$blocker.click(function(t){t.target==this&&o.modal.close()})},close:function(){s.pop(),this.unblock(),this.hide(),o.modal.isActive()||o(e).off("keydown.modal")},block:function(){this.$elm.trigger(o.modal.BEFORE_BLOCK,[this._ctx()]),this.$body.css("overflow","hidden"),this.$blocker=o('
').appendTo(this.$body),n(),this.options.doFade&&this.$blocker.css("opacity",0).animate({opacity:1},this.options.fadeDuration),this.$elm.trigger(o.modal.BLOCK,[this._ctx()])},unblock:function(t){!t&&this.options.doFade?this.$blocker.fadeOut(this.options.fadeDuration,this.unblock.bind(this,!0)):(this.$blocker.children().appendTo(this.$body),this.$blocker.remove(),this.$blocker=null,n(),o.modal.isActive()||this.$body.css("overflow",""))},show:function(){this.$elm.trigger(o.modal.BEFORE_OPEN,[this._ctx()]),this.options.showClose&&(this.closeButton=o(''+this.options.closeText+""),this.$elm.append(this.closeButton)),this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker),this.options.doFade?this.$elm.css("opacity",0).show().animate({opacity:1},this.options.fadeDuration):this.$elm.show(),this.$elm.trigger(o.modal.OPEN,[this._ctx()])},hide:function(){this.$elm.trigger(o.modal.BEFORE_CLOSE,[this._ctx()]),this.closeButton&&this.closeButton.remove();var t=this;this.options.doFade?this.$elm.fadeOut(this.options.fadeDuration,function(){t.$elm.trigger(o.modal.AFTER_CLOSE,[t._ctx()])}):this.$elm.hide(0,function(){t.$elm.trigger(o.modal.AFTER_CLOSE,[t._ctx()])}),this.$elm.trigger(o.modal.CLOSE,[this._ctx()])},showSpinner:function(){this.options.showSpinner&&(this.spinner=this.spinner||o('
').append(this.options.spinnerHtml),this.$body.append(this.spinner),this.spinner.show())},hideSpinner:function(){this.spinner&&this.spinner.remove()},_ctx:function(){return{elm:this.$elm,$blocker:this.$blocker,options:this.options}}},o.modal.close=function(t){if(o.modal.isActive()){t&&t.preventDefault();var e=l();return e.close(),e.$elm}},o.modal.isActive=function(){return s.length>0},o.modal.getCurrent=l,o.modal.defaults={closeExisting:!0,escapeClose:!0,clickClose:!0,closeText:"Close",closeClass:"",modalClass:"modal",spinnerHtml:null,showSpinner:!0,showClose:!0,fadeDuration:null,fadeDelay:1},o.modal.BEFORE_BLOCK="modal:before-block",o.modal.BLOCK="modal:block",o.modal.BEFORE_OPEN="modal:before-open",o.modal.OPEN="modal:open",o.modal.BEFORE_CLOSE="modal:before-close",o.modal.CLOSE="modal:close",o.modal.AFTER_CLOSE="modal:after-close",o.modal.AJAX_SEND="modal:ajax:send",o.modal.AJAX_SUCCESS="modal:ajax:success",o.modal.AJAX_FAIL="modal:ajax:fail",o.modal.AJAX_COMPLETE="modal:ajax:complete",o.fn.modal=function(t){return 1===this.length&&new o.modal(this,t),this},o(e).on("click.modal",'a[rel~="modal:close"]',o.modal.close),o(e).on("click.modal",'a[rel~="modal:open"]',function(t){t.preventDefault(),o(this).modal()})}); -------------------------------------------------------------------------------- /website/inc/js/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/layouts/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/layouts/topRight.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Nedim Arabacı 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | $.noty.layouts.topRight = { 25 | name : 'topRight', 26 | options : { // overrides options 27 | 28 | }, 29 | container: { 30 | object : '
    ', 31 | selector: 'ul#noty_topRight_layout_container', 32 | style : function() { 33 | $(this).css({ 34 | top : 20, 35 | right : 20, 36 | position : 'fixed', 37 | width : '310px', 38 | height : 'auto', 39 | margin : 0, 40 | padding : 0, 41 | listStyleType: 'none', 42 | zIndex : 10000000 43 | }); 44 | 45 | if(window.innerWidth < 600) { 46 | $(this).css({ 47 | right: 5 48 | }); 49 | } 50 | } 51 | }, 52 | parent : { 53 | object : '
  • ', 54 | selector: 'li', 55 | css : {} 56 | }, 57 | css : { 58 | display: 'none', 59 | width : '310px' 60 | }, 61 | addClass : '' 62 | }; 63 | -------------------------------------------------------------------------------- /website/inc/js/metrics/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/postProcessing/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/preProcessing/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/recipe/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/settings/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/js/transferStation/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/php/footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /website/inc/php/header.php: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | GOSINT - <?php echo getTitle(); ?> 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
    37 | 38 | 42 | 43 | 44 |
    45 | 46 | 47 |
    48 | -------------------------------------------------------------------------------- /website/inc/php/index.php: -------------------------------------------------------------------------------- 1 | No peeking 2 | -------------------------------------------------------------------------------- /website/inc/php/sidebar.php: -------------------------------------------------------------------------------- 1 | 2 | 37 | 38 | -------------------------------------------------------------------------------- /website/inc/php/title-selector.php: -------------------------------------------------------------------------------- 1 | 57 | -------------------------------------------------------------------------------- /website/index.php: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 |
    9 |
    10 |

    Welcome to GOSINT!

    11 |

    The GOSINT framework is a project used for collecting, processing, and exporting high quality indicators of compromise (IOCs). GOSINT allows a security analyst to collect and standardize structured and unstructured threat intelligence.

    12 |

    Applying threat intelligence to security operations enriches alert data with additional confidence, context, and co-occurrence. This means that you apply research from third parties to security event data to identify similar, or identical, indicators of malicious behavior.

    13 |
    14 |
    15 | 16 | 17 | 18 |
    19 | 20 | 21 |
    22 | 23 |

    Indicator Metrics

    24 |

    View a breakdown of the indicators currently loaded into GOSINT below.

    25 | 26 |

    Loading metrics...

    27 | 28 | 29 |
    30 | 31 | 32 |
    33 |   34 |
    35 | 36 | 37 | 38 |
    39 |
    40 |
    41 |
    42 |
    43 |
    44 |
    45 | 46 | 47 | 48 |
    49 |   50 |
    51 | 52 | 53 | 54 |
    55 |
    56 |
    57 |
    58 |
    59 |
    60 |
    61 | 62 | 63 |
    64 | 65 | 66 |
    67 | < 68 | 69 |
    70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 82 | 83 | -------------------------------------------------------------------------------- /website/metrics.php: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 |
    9 | 10 | 11 |
    12 | 13 |

    Indicator Metrics

    14 |

    View a breakdown of the indicators currently loaded into GOSINT below.

    15 | 16 | 17 | 18 | 19 |

    Loading metrics...

    20 | 21 | 22 |
    23 | 24 | 25 |
    26 |   27 |
    28 | 29 | 30 | 31 |
    32 |
    33 |
    34 |
    35 |
    36 |
    37 |
    38 | 39 | 40 | 41 |
    42 |   43 |
    44 | 45 | 46 | 47 |
    48 |
    49 |
    50 |
    51 |
    52 |
    53 |
    54 | 55 | 56 |
    57 | 58 | 59 |
    60 | 61 | 62 |
    63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 75 | 76 | -------------------------------------------------------------------------------- /website/post-processing.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 |
    7 | 8 | 9 |
    10 | 11 |

    Post-Processing

    12 |

    Indicators that have been moved from pre-processing are available for viewing here.

    13 | 14 | 15 |
    16 |
    17 |
    18 |
    19 |
    20 |

    Loading indicators...

    21 |
    22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
    77 | 78 | 79 |
    80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 102 | --------------------------------------------------------------------------------