Skip to content

Commit

Permalink
Re-import of release 1.6.1 for public consumption.
Browse files Browse the repository at this point in the history
  • Loading branch information
leaf-fastly committed Aug 6, 2019
0 parents commit 7653e47
Show file tree
Hide file tree
Showing 32 changed files with 3,585 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
*~
*.log

artifacts
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.prof
82 changes: 82 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# GoLang Module Release Notes

## Unreleased


## 1.6.1 2019-06-13

* Cleaned up internal code

## 1.6.0 2019-05-30

* Updated list of inspectable XML content types
* Added `http.Flusher` interface when the underlying handler supports this interface
* Updated timeout to include time to connect to the agent
* Cleaned up docs/code/examples

## 1.5.0 2019-01-31

* Switched Update / Post RPC call to async
* Internal release for agent reverse proxy

## 1.4.3 2018-08-07

* Improved error and debug messages
* Exposed more functionality to allow easier extending


## 1.4.2 2018-06-15
* Improved handling of the `Host` request header
* Improved debugging output

## 1.4.1 2018-06-04
* Improved error and debug messages

## 1.4.0 2018-05-24

* Standardized release notes
* Added support for multipart/form-data post
* Extended architecture to allow more flexibility
* Updated response writer interface to allow for WebSocket use
* Removed default filters on CONNECT/OPTIONS methods - now inspected by default
* Standardized error page
* Updated to contact agent on init for faster module registration

## 1.3.1 2017-09-25

* Removed unused dependency
* Removed internal testing example

## 1.3.0 2017-09-19

* Improved internal testing
* Updated msgpack serialization

## 1.2.3 2017-09-11

* Standardized defaults across modules and document
* Bad release

## 1.2.2 2017-07-02

* Updated to use [signalsciences/tlstext](https://github.com/signalsciences/tlstext)

## 1.2.1 2017-03-21

* Added ability to send XML post bodies to agent
* Improved content-type processing

## 1.2.0 2017-03-06

* Improved performance
* Exposed internal datastructures and methods
to allow alternative module implementations and
performance tests

## 1.1.0 2017-02-28

* Fixed TCP vs. UDS configuration

## 0.1.0 2016-09-02

* Initial release
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.10.6-alpine3.8

COPY goroot/ /go/
# this is used to lint and build tarball
RUN gometalinter --install --debug

# we will mount the current directory here
VOLUME [ "/go/src/github.com/signalsciences/sigsci-module-golang" ]
WORKDIR /go/src/github.com/signalsciences/sigsci-module-golang
2 changes: 2 additions & 0 deletions Dockerfile.git
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM golang:1.10.6-alpine3.8
RUN apk --update add git
24 changes: 24 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# sigsci-module-golang

The MIT License (MIT)

Copyright (c) 2019 Signal Sciences Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@


build: ## build and lint locally
./scripts/build.sh

# clean up each time to make sure nothing is cached between runs
#
test: ## build and run integration test
./scripts/test.sh

init: ## install gometalinter and msgp locally
go get -u github.com/alecthomas/gometalinter
gometalinter --install --debug
go get -u github.com/tinylib/msgp/msgp
go get .


clean: ## cleanup
find . -name 'goroot' -type d | xargs rm -rf
rm -rf artifacts
find . -name '*.log' | xargs rm -f
go clean ./...
git gc

# https://www.client9.com/self-documenting-makefiles/
help:
@awk -F ':|##' '/^[^\t].+?:.*?##/ {\
printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \
}' $(MAKEFILE_LIST)
.DEFAULT_GOAL=help
.PHONY=help
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# sigsci-module-golang

The Signal Sciences module in golang allows for integrating your golang
application directly with the Signal Sciences agent at the source code
level. This golang module is written as a `http.Handler` wrapper. To
integrate your application with the module, you will need to wrap your
existing handler with the module handler.

Example Code Snippet:
```go
// Existing http.Handler
mux := http.NewServeMux()
mux.HandleFunc("/", helloworld)

// Wrap the existing http.Handler with the SigSci module handler
wrapped, err := sigsci.NewModule(
// Existing handler to wrap
mux,

// Any additional module options:
//sigsci.Socket("unix", "/var/run/sigsci.sock"),
//sigsci.Timeout(100 * time.Millisecond),
//sigsci.AnomalySize(512 * 1024),
//sigsci.AnomalyDuration(1 * time.Second),
//sigsci.MaxContentLength(100000),
)
if err != nil {
log.Fatal(err)
}

// Listen and Serve as usual using the wrapped sigsci handler
s := &http.Server{
Handler: wrapped,
Addr: "localhost:8000",
}
log.Fatal(s.ListenAndServe())
```

## Dependencies

The golang module requires two prerequisite packages to be installed:
[MessagePack Code Generator](https://github.com/tinylib/msgp/) and the
Signal Sciences custom [tlstext](https://github.com/signalsciences/tlstext)
package.

The easiest way to install these packages is by using the `go get`
command to download and install these packages directly from their
public GitHub repositories:

```bash
go get -u -t github.com/tinylib/msgp/msgp
go get -u -t github.com/signalsciences/tlstext
```

## Examples

The [examples](examples/) directory contains complete example code.

To run the simple [helloworld](examples/helloworld/main.go) example:

```bash
go run examples/helloworld/main.go
```

Or, if your agent is running with a non-default `rpc-address`, you can
pass the sigsci-agent address as an argument such as one of the following:

```bash
# Another UNIX Domain socket
go run examples/helloworld/main.go /tmp/sigsci.sock
# A TCP address:port
go run examples/helloworld/main.go localhost:9999
```

This will run a HTTP listener on `localhost:8000`, which will send any
traffic to this listener to a running sigsci-agent for inspection.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.6.2
Loading

0 comments on commit 7653e47

Please sign in to comment.