Skip to content

Commit

Permalink
Merge pull request #1 from circa10a/docs
Browse files Browse the repository at this point in the history
#patch: update field docs and deps
  • Loading branch information
circa10a committed Oct 17, 2022
2 parents d738b1e + 50dd83d commit 7304d6b
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 1,316 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# behavior.
before:
hooks:
- go mod tidy
- go mod tidy -compat=1.17
builds:
- skip: true
changelog:
Expand Down
40 changes: 20 additions & 20 deletions caddy_geofence.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,38 @@ const (
type CaddyGeofence struct {
logger *zap.Logger
geofenceClient *geofence.Geofence
// ipbase_api_token is REQUIRED and is an API token ipbase.com
// Free tier includes 150 requests per month
// ipbase_api_token is REQUIRED and is an API token ipbase.com.
// Free tier includes 150 requests per month.
IPBaseAPIToken string `json:"ipbase_api_token,omitempty"`
// remote_ip is the IP address to geofence against
// Not specifying this field results in geofencing the public address of the machine caddy is running on
// remote_ip is the IP address to geofence against.
// Not specifying this field results in geofencing the public address of the machine caddy is running on.
RemoteIP string `json:"remote_ip,omitempty"`
// allowlist is a list of IP addresses that will not be checked for proximity and will be allowed to access the server
// allowlist is a list of IP addresses that will not be checked for proximity and will be allowed to access the server.
Allowlist []string `json:"allowlist,omitempty"`
// status_code is the HTTP response code that is returned if IP address is not within proximity. Default is 403
// status_code is the HTTP response code that is returned if IP address is not within proximity. Default is 403.
StatusCode int `json:"status_code,omitempty"`
// cache_ttl is string parameter for caching ip addresses with their allowed/not allowed state
// Not specifying a TTL sets no expiration on cached items and will live until restart
// Valid time units are "ms", "s", "m", "h"
// In-memory cache is used if redis is not enabled
// cache_ttl is string parameter for caching ip addresses with their allowed/not allowed state.
// Not specifying a TTL sets no expiration on cached items and will live until restart.
// Valid time units are "ms", "s", "m", "h".
// In-memory cache is used if redis is not enabled.
CacheTTL time.Duration `json:"cache_ttl,omitempty"`
// radius is the distance of the geofence in kilometers
// If not supplied, will default to 0.0 kilometers
// 1.0 => 1.0 kilometers
// radius is the distance of the geofence in kilometers.
// If not supplied, will default to 0.0 kilometers.
// 1.0 => 1.0 kilometers.
Radius float64 `json:"radius"`
// allow_private_ip_addresses is a boolean for whether or not to allow private ip ranges
// such as 192.X, 172.X, 10.X, [::1] (localhost). Default is false
// Some cellular networks doing NATing with 172.X addresses, in which case, you may not want to allow
// such as 192.X, 172.X, 10.X, [::1] (localhost). Default is false.
// Some cellular networks doing NATing with 172.X addresses, in which case, you may not want to allow.
AllowPrivateIPAddresses bool `json:"allow_private_ip_addresses"`
// RedisEnabled uses redis for caching. Default is false
// redis_enabled uses redis for caching. Default is false.
RedisEnabled bool `json:"redis_enabled,omitempty"`
// RedisUsername is the username to connect to a redis instance. Default is ""
// redis_username is the username to connect to a redis instance. Default is "".
RedisUsername string `json:"redis_username,omitempty"`
// RedisPassword is the password to connect to a redis instance. Default is ""
// redis_password is the password to connect to a redis instance. Default is "".
RedisPassword string `json:"redis_password,omitempty"`
// RedisAddr is the address to connect to a redis instance. Default is localhost:6379
// redis_addr is the address to connect to a redis instance. Default is localhost:6379.
RedisAddr string `json:"redis_addr,omitempty"`
// RedisDB is the db id. Default is 0
// redis_db is the db id. Default is 0.
RedisDB int `json:"redis_db,omitempty"`
}

Expand Down
58 changes: 31 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ module github.com/circa10a/caddy-geofence
go 1.17

require (
github.com/caddyserver/caddy/v2 v2.5.2
github.com/caddyserver/caddy/v2 v2.6.2
github.com/circa10a/go-geofence v0.7.0
github.com/go-redis/redis/v9 v9.0.0-rc.1
go.uber.org/zap v1.23.0
)

Expand All @@ -15,25 +16,24 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220826213629-cd8f367ca010 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/caddyserver/certmagic v0.17.0 // indirect
github.com/caddyserver/certmagic v0.17.2 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/dgraph-io/badger v1.6.2 // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-redis/redis/v9 v9.0.0-beta.2 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
Expand All @@ -45,25 +45,26 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.13.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.12.0 // indirect
github.com/jackc/pgx/v4 v4.17.1 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/jackc/pgx/v4 v4.17.2 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/klauspost/cpuid/v2 v2.1.2 // indirect
github.com/libdns/libdns v0.2.1 // indirect
github.com/lucas-clemente/quic-go v0.29.0 // indirect
github.com/lucas-clemente/quic-go v0.29.2 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/marten-seemann/qpack v0.2.1 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect
github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect
github.com/marten-seemann/qpack v0.3.0 // indirect
github.com/marten-seemann/qtls-go1-18 v0.1.3 // indirect
github.com/marten-seemann/qtls-go1-19 v0.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mholt/acmez v1.0.4 // indirect
github.com/micromdm/scep/v2 v2.1.0 // indirect
Expand All @@ -84,36 +85,39 @@ require (
github.com/shopspring/decimal v1.3.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/slackhq/nebula v1.6.0 // indirect
github.com/slackhq/nebula v1.6.1 // indirect
github.com/smallstep/certificates v0.22.1 // indirect
github.com/smallstep/cli v0.22.0 // indirect
github.com/smallstep/nosql v0.4.0 // indirect
github.com/smallstep/nosql v0.5.0 // indirect
github.com/smallstep/truststore v0.12.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/tailscale/tscert v0.0.0-20220316030059-54bbcb9f74e2 // indirect
github.com/urfave/cli v1.22.9 // indirect
github.com/urfave/cli v1.22.10 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
go.step.sm/cli-utils v0.7.4 // indirect
go.step.sm/crypto v0.19.0 // indirect
go.step.sm/cli-utils v0.7.5 // indirect
go.step.sm/crypto v0.21.0 // indirect
go.step.sm/linkedca v0.18.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91 // indirect
golang.org/x/crypto v0.0.0-20221012134737-56aed061732a // indirect
golang.org/x/exp v0.0.0-20221012211006-4de253d81b95 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.8-0.20211105212822-18b340fc7af2 // indirect
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 // indirect
golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect
golang.org/x/text v0.3.8 // indirect
golang.org/x/tools v0.1.12 // indirect
google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf // indirect
google.golang.org/grpc v1.49.0 // indirect
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v1.0.0 // indirect
)

Expand Down
Loading

0 comments on commit 7304d6b

Please sign in to comment.