267 Commits

Author SHA1 Message Date
61d068c95c
refactor(ippolicy): separate policy loading from evaluation net/ippolicy/v0.9.3 2026-09-10 02:09:17 -06:00
db1d4c55a9
refactor(sync): rename cacheable package net/geoip/v0.6.1 net/ippolicy/v0.9.2 net/iplist/v0.9.2 sync/cacheable/v0.1.0 sync/dataset/v0.6.1 2026-09-10 02:08:36 -06:00
7990917414
chore(cmd/form2mail): update stacked release dependencies
(cherry picked from commit 97606f9d1d511cf76431843a989ed76bed9f39db)
cmd/form2mail/v0.3.2
2026-09-10 01:13:46 -06:00
3cbb52ee36
refactor(cmd/form2mail): rebase release onto main
(cherry picked from commit bf052b4904918913250a7108e704ef5ac4f1c725)
2026-09-10 01:13:46 -06:00
8648c5accb
refactor(cmd/check-ip): use released cache modules cmd/check-ip/v0.1.2 2026-09-10 00:46:30 -06:00
4e85e00d5a
feat(cmd/check-ip): reference CLI exercising ipcohort + geoip + dataset 2026-09-10 00:46:30 -06:00
5221e0e1c3
chore(net/formmailer): update stacked release dependencies net/formmailer/v0.3.1 2026-09-10 00:46:23 -06:00
0e6faecf6c
refactor(net/formmailer): rebase release onto main 2026-09-10 00:45:56 -06:00
be816d8da0
chore(net/ippolicy): use released iplist tag net/ippolicy/v0.9.1 2026-09-10 00:45:12 -06:00
27ba97de6d
refactor(net/ippolicy): publish shared cache policy 2026-09-10 00:41:40 -06:00
48a4f2a145
refactor(net/iplist): use released cache APIs net/iplist/v0.9.1 2026-09-10 00:21:39 -06:00
87ab75126a
refactor(net/geoip): use released cache APIs net/geoip/v0.6.0 2026-09-09 23:35:39 -06:00
c43fd48b34
refactor(sync/dataset): use released cachable API 2026-09-09 23:35:21 -06:00
efa686e649
refactor(sync/cachable): finalize release API 2026-09-09 23:35:08 -06:00
fac7ffad84
refactor(net/httpcache): finalize release API 2026-09-09 23:34:52 -06:00
21cb0bc677
refactor(net/gitshallow): finalize release API 2026-09-09 23:34:39 -06:00
9d2f2cb402
refactor(net/dnsresolver): finalize release API net/dnsresolver/v0.6.0 2026-09-09 22:29:00 -06:00
b67ea17776 chore(net/ipcohort): whitespace 2026-09-09 03:20:28 -06:00
758fee503d test(gsheet2csv): cover empty rows, blank lines, and comments io/transform/gsheet2csv/v1.1.2 2026-09-09 03:20:28 -06:00
8a928d0e9c fix gsheet reader skip empty records 2026-09-09 03:20:28 -06:00
07d4a2652c
feat!(ippolicy): share refreshed IP policy behavior
Rename net/ipgate to net/ippolicy and compose independently refreshed
whitelist and blacklist sources into one IP decision policy.

- rename slog group and error prefixes from ipgate to ippolicy
- delete unused ParseDomainSet and RecordReader from domainsetcsv.go
- rewrite README to match the actual Config API
- document nil-whitelist behavior on New()
- bump iplist dependency to v0.8.5
- go mod tidy: remove stale ipgate and iplist entries
net/ippolicy/v0.8.5
2026-09-09 02:55:09 -06:00
869086ce0c
feat(iplist): add refreshable Source net/iplist/v0.8.5 2026-09-09 02:54:34 -06:00
1cb0235d9d
feat(ipgate): configure matcher refresh intervals net/ipgate/v0.6.2 2026-09-09 02:29:23 -06:00
03722a2934
feat(iplist): allow custom HTTP clients net/iplist/v0.7.0 2026-09-09 01:14:05 -06:00
c41ac3732d
feat(iplist): load and validate IP policy entries from TSV/CSV sources
Add net/iplist for shared IP-policy source loading.

- Accept local TSV/CSV file paths or HTTP(S) URLs (including Google Sheets).
- Auto-detect TSV vs CSV format from file content.
- Send Accept: text/tab-separated-values header for content negotiation.
- Parse the first column and ignore comments (#) and optional "network" header.
- Expand nested list URLs up to MaxNestedSources (2) levels.
- Support Basic Auth from URL userinfo without sending credentials in the URL.
- Persist cached URL responses across restarts via httpcache.
- Refresh periodically and preserve the known-good cache on fetch or parse failure.
- Validate entries as IP address, CIDR range, or domain name (Validate()).
- Use golib/https.NewInternalClient() through httpcache.NewWith.
- Add README with usage examples and entry format documentation.
2026-09-08 22:46:17 -06:00
a16ec976bb
feat(gsheet2csv): add context and custom-client APIs
Add non-breaking context-aware and custom-HTTP-client variants of the
existing reader and fetch functions:

- NewReaderFromContext / NewReaderFromContextWith
- NewReaderFromURLContext / NewReaderFromURLWith
- NewReaderFromIDsContext
- GetSheetContext

All existing function signatures are unchanged. The shared response
handling is extracted into newReaderFromResponse, and the legacy GetSheet
path is refactored through getSheetWithGet for clarity.
io/transform/gsheet2csv/v1.1.1
2026-09-08 22:46:11 -06:00
bb488fe230 fix(net/ipgate): prevent nil cohort by construction, extract cachedCohortValid
Ensure cohort is never nil:
- NewDomainSet stores an empty Cohort before rebuildCohort, so a parse
  failure leaves an empty (non-nil) cohort instead of nil
- Contains uses CompareAndSwap to lazily self-initialise a zero-value
  struct, making nil impossible after first access — no explicit nil
  check needed

Extract the cache-validity check into a testable cachedCohortValid()
helper and add filesPresent() to detect when data files exist on disk.

Use strings.Builder in commaify() for efficiency.

Tests:
- TestPrefixSetContainsZeroValue: zero-value self-heals via CAS,
  cohort is non-nil after first Contains call
- TestCachedCohortValidRequiresFiles: cache invalidation logic
net/ipgate/v0.5.3
2026-09-08 20:36:43 -06:00
70d95be546 test(net/gitshallow): support modern git orphan branches net/gitshallow/v0.9.3 2026-09-08 20:16:37 -06:00
4260287467 chore(net/gitshallow): add .goreleaser.yaml 2026-09-08 20:16:37 -06:00
f7ca1d22a5
feat(geoip-update): align CLI flags with conventions 2026-09-08 15:19:38 -06:00
e82e3979d2
fix(geoip): update httpcache dependency net/geoip/v0.5.1 2026-09-08 14:47:28 -06:00
05505c3554
fix(geoip-update): back off failed downloads 2026-09-08 14:44:48 -06:00
71f7752015
fix(httpcache): back off after failed fetches net/httpcache/v0.5.1 2026-09-08 14:44:48 -06:00
70aa1cbaa4
chore: remove comment io/transform/gsheet2csv/v1.1.0 2026-08-19 15:02:50 -06:00
1d16cabf87
doc(auth/jwt): add README.md (condensed from doc.go) auth/jwt/v0.10.1 2026-08-17 23:38:42 -06:00
392b8bc0f9
feat(auth/jwt): add HMACSigner/HMACVerifier 2026-08-17 23:38:42 -06:00
ab3013609a
chore(auth/jwt): enforce Signer/Verifier interfaces internally 2026-08-17 23:38:42 -06:00
20c7887bcd
test(auth): add AuthorizationSchemes tests (any-scheme, unaccepted scheme)
Add tests for AuthorizationSchemes ["*"] accepting any scheme and
for unaccepted schemes returning ErrNoCredentials without falling
through to cookies. These fill pre-existing test gaps unrelated to
the TokenCookies feature.
auth/v1.2.0
2026-08-17 23:15:24 -06:00
4b4a83b220
test(auth): add tests for BasicRequestAuthenticator including TokenCookies
Cover cookie extraction, priority ordering, empty value skipping,
error propagation, and existing gaps (Bearer any-scheme, unaccepted
scheme rejection, Basic Auth priority).
2026-08-17 23:15:18 -06:00
a87529dc5f
feat(auth): add TokenCookies to BasicRequestAuthenticator
Add a TokenCookies []string field checked after query params (step 5).
Each named cookie's value is passed directly to Authenticator.Authenticate
as a token, enabling cookie-based token flows alongside Bearer and query params.
2026-08-17 21:34:59 -06:00
484b6bc11a
fix(io/transform/gsheet2csv): use safe defaults for http client io/transform/gsheet2csv/v1.0.6 2026-08-17 17:25:45 -06:00
c66c4a8de4
ref!(https): rewrite with latest best practices, for publish https/v0.9.0 2026-08-17 15:15:09 -06:00
71671b7852
fix(sql-migrate): add missing period 'basename+".up.sql"' 2026-07-07 16:40:37 -06:00
bc3fb945af
chore(sql-migrate): lint 2026-07-07 16:30:13 -06:00
3e2b055c88
fix(sql-migrate): strip id\t prefix when parsing migrations.log
parseAndFixupBatches treated every line as a migration name, but the
new log format uses id\tname (tab-separated). This caused fixupMigration
to look for non-existent files like '05aba66a\t2026-06-03-003000_team-create.up.sql'.

Align with shmigrate.Applied() which already handles both formats.
cmd/sql-migrate/v2.2.5
2026-06-04 22:08:22 -06:00
a408dc890b
feat(sync/dataset): generic hot-swap refresh with atomic.Pointer
Coordinates a Set of Fetchers (each producing a typed dataset) so a
running server can swap to fresh data without locks on the read path.
Readers go through atomic.Pointer; Load/Close are mutex-serialized so
concurrent reloads can't race. Add and AddInitial register fetchers
before the first Load.
sync/dataset/v0.5.0
2026-05-26 22:46:04 -06:00
584061744b
feat(geoip-update): CLI for downloading GeoLite2 databases via conditional HTTP GET
- Downloads all editions listed in a GeoIP.conf
  - Flags: -config, -dir, -fresh-days, -base-url (override
    DownloadBase for custom mirror/proxy), -V/--version, -help
  - Version output shows name, version, commit, date, copyright and
    license (populated via ldflags at build time)
  - Uses Basic auth with split credential encoding for readability
  - ETag/Last-Modified caching via httpcache
net/geoip/v0.5.0 ‎net/geoip/v0.5.0
2026-05-26 22:04:22 -06:00
2f33b5e430
feat(net/geoip): MaxMind GeoLite2 reader with auto-update
Add a Go package for reading MaxMind GeoLite2 City and ASN databases.

  - ParseConf: parses geoipupdate-style config files (AccountID,
    LicenseKey, EditionIDs, DatabaseDirectory)
  - Databases: holds open City + ASN readers; Open() loads both
    editions from a directory, extracting .mmdb from tar.gz in memory
    without writing to disk
  - FindTarGz: resolves cache paths, preferring *_LATEST.tar.gz
  - Lookup: returns city, region, country, ASN, and AS org for an IP
  - DownloadBase constant, TarGzName helper, DefaultConfPaths and
    DefaultCacheDir conveniences

Integration tests verify download and conditional-get freshness.
2026-05-26 22:04:17 -06:00
ecba24973b
chore: add LOCAL.md and agents/ to .gitignore 2026-05-26 21:59:57 -06:00
04b8bb406d
feat(net/httpcache): ETag/Last-Modified HTTP cache
Conditional GET cache for periodic data sources. Persists ETag and
Last-Modified to a .meta sidecar so 304s survive process restarts.
Two independent rate-limit gates (MaxAge file-mtime, MinInterval
in-memory). Body cap via MaxBytes defends against fill-disk from a
hostile upstream or redirect target. Authorization (and any
caller-supplied) headers stripped on every redirect hop. Userinfo
in URL is redacted from error messages.
net/httpcache/v0.5.0
2026-05-26 01:27:20 -06:00