Skip to content

Commit

Permalink
Add small api for IP validation of members
Browse files Browse the repository at this point in the history
Kamailio can use an API call to validate a source IP as a member of a
given dispatcher set.  This can be an easier, more direct way of
establishing source IP trust than separately maintaining that table.

If enabled (via the -api flag), the service will listen for HTTP
requests to `/check/<setID>/<ip address>` and return a 200 OK if and
only if that IP address is a member of that dispatcher set.

This also converts to go modules.
  • Loading branch information
Ulexus committed Jan 10, 2020
1 parent 4c911ea commit 4f9c719
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 220 deletions.
11 changes: 5 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ changelog:
- '^docs:'
- '^test:'
dockers:
- image: cycoresystems/dispatchers
tag_templates:
- "{{ .Tag }}"
- "v{{ .Major }}"
- "v{{ .Major }}.{{ .Minor }}"
- latest
- image_templates:
- "cycoresystems/dispatchers:{{ .Tag }}"
- "cycoresystems/dispatchers:v{{ .Major }}"
- "cycoresystems/dispatchers:v{{ .Major }}.{{ .Minor }}"
- cycoresystems/dispatchers:latest
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
language: go
env:
- GO111MODULE=on
go:
- "1.11"
- "1.13"
install:
- go get -u github.com/golang/dep/cmd/dep/...
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0
- curl -sfL https://github.com/goreleaser/goreleaser/releases/download/v0.101.0/goreleaser_Linux_x86_64.tar.gz | tar xfz - -C $GOPATH/bin goreleaser
- go mod tidy
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.21.0
- curl -sfL https://github.com/goreleaser/goreleaser/releases/download/v0.123.3/goreleaser_Linux_x86_64.tar.gz | tar xfz - -C $GOPATH/bin goreleaser
script: bash ci_check.sh
services:
- docker
Expand Down
110 changes: 0 additions & 110 deletions Gopkg.lock

This file was deleted.

38 changes: 0 additions & 38 deletions Gopkg.toml

This file was deleted.

1 change: 0 additions & 1 deletion ci_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash -e
dep ensure
golangci-lint run
go test ./...
go build ./...
Expand Down
15 changes: 15 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module github.com/CyCoreSystems/dispatchers

go 1.12

require (
github.com/CyCoreSystems/go-kamailio v0.2.0
github.com/ericchiang/k8s v1.1.0
github.com/ghodss/yaml v1.0.0
github.com/golang/protobuf v1.1.0 // indirect
github.com/pkg/errors v0.8.0
golang.org/x/net v0.0.0-20180502164142-640f4622ab69 // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
golang.org/x/text v0.3.0 // indirect
gopkg.in/yaml.v2 v2.2.1 // indirect
)
20 changes: 20 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
github.com/CyCoreSystems/go-kamailio v0.2.0 h1:5B07UodsIQLI3OZ+CtSJX8yaetLI1C0vUNHmGymD42w=
github.com/CyCoreSystems/go-kamailio v0.2.0/go.mod h1:oTRjwxfuRAZWbDbXRkUIBGIhd4bvu/H5Nkr9ozJZVSc=
github.com/ericchiang/k8s v1.1.0 h1:XjBbrZhlvos0PtQrvvSIPAeinnrYM4c/QKB0CWfnoJU=
github.com/ericchiang/k8s v1.1.0/go.mod h1:/OmBgSq2cd9IANnsGHGlEz27nwMZV2YxlpXuQtU3Bz4=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/golang/protobuf v1.1.0 h1:0iH4Ffd/meGoXqF2lSAhZHt8X+cPgkfn/cb6Cce5Vpc=
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/net v0.0.0-20180502164142-640f4622ab69 h1:+Ybm3UzSfPpp+Hlr62ZTCtbC9DmCKX61f0r74+peGts=
golang.org/x/net v0.0.0-20180502164142-640f4622ab69/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
48 changes: 0 additions & 48 deletions kamailio/kamailio.go

This file was deleted.

Loading

0 comments on commit 4f9c719

Please sign in to comment.