439 Commits

Author SHA1 Message Date
Slyghtning
47fe3e563e Merge pull request #203 from hieblmi/bump-dockr
docker: bump go to 1.24.9
v0.4.2
2026-01-27 16:39:55 +01:00
Slyghtning
902b0c57c5 docker: bump go to 1.24.9 2026-01-27 16:30:17 +01:00
Slyghtning
2b66035eae Merge pull request #195 from hieblmi/rate-limiter
proxy: a configurable rate-limiter per endpoint and L402
v0.4.1
2026-01-23 10:42:39 -05:00
Slyghtning
dcbadf87a5 ratelimiter: narrow down mutex access 2026-01-23 10:12:13 -05:00
Slyghtning
0a8c25703b README: add section about rate limiting 2026-01-23 09:22:47 -05:00
Slyghtning
600cf505b9 sample-conf: document rate limit configuration
Add example rate limit configuration to the sample config file,
demonstrating:

- Token bucket parameters: pathregexp, requests, per, burst
- Multiple rules per service with different strictness levels
- Documentation of per-L402 token ID scoping with IP fallback
2026-01-23 09:22:47 -05:00
Slyghtning
c289dd6f90 proxy: apply ip4/ip6 filtering for unauthenticated requests 2026-01-23 09:22:47 -05:00
Slyghtning
011dc72e4b proxy: add rate limiter unit tests
Add comprehensive unit tests for the rate limiter implementation:

- TestRateLimiterBasic: Verify basic token bucket behavior
- TestRateLimiterNoMatchingRules: Requests pass when no rules match
- TestRateLimiterLRUEviction: Cache respects max size limit
- TestRateLimiterPathMatching: Different paths have independent limits
- TestRateLimiterMultipleRulesAllMustPass: Strictest matching rule wins
- TestRateLimiterPerKeyIsolation: Different users have separate quotas
- TestExtractRateLimitKeyIP/IPv6: IP-based key extraction
- TestRateLimitConfigRate/EffectiveBurst/Matches: Config calculations
- TestSendRateLimitResponseHTTP/GRPC: Response format verification
- TestRateLimiterTokenRefill: Token bucket refills over time
2026-01-23 09:22:44 -05:00
Slyghtning
be65147fee proxy: integrate rate limiter into service and proxy
Add rate limiting integration to the aperture proxy:

- Service struct: Add RateLimits configuration field and rateLimiter
  instance field
- prepareServices(): Validate rate limit config at startup, compile
  path regexes, and initialize RateLimiter instances per service
- ServeHTTP(): Check rate limits after auth level determination but
  before authentication, applying to all requests including
  auth-whitelisted paths
- sendRateLimitResponse(): Return HTTP 429 with Retry-After header for
  REST clients, or gRPC ResourceExhausted status for gRPC clients

The rate limiter key is extracted from the L402 token ID when present,
falling back to the client IP address for unauthenticated requests.
2026-01-23 09:05:56 -05:00
Slyghtning
a3ee1e0d17 proxy: implement a token-bucket rate limiter for aperture
Implement a token-bucket rate limiter for aperture that limits requests
per service endpoint. The rate limiter uses golang.org/x/time/rate and
provides per-key limiting with L402 token ID extraction (falling back
to IP address for unauthenticated requests).

Key components:
- RateLimitConfig: Configuration struct with path regex, requests/per/burst
- RateLimiter: Manages per-key rate.Limiter instances with LRU eviction
  to prevent memory exhaustion (default 10,000 entries)
- Prometheus metrics: allowed/denied counters, cache size, evictions

This addresses GitHub issue #200 for DoS protection on authenticated
endpoints that are free of charge after L402 payment.
2026-01-23 09:05:55 -05:00
Slyghtning
704acacca0 Merge pull request #201 from hieblmi/bump-lnd
go.mod: bump lnd to v0.20.0-beta
v0.4.0
2026-01-13 15:20:52 +01:00
Slyghtning
b732b1a0e2 go.mod: bump lnd to v0.20.0-beta 2026-01-13 14:33:58 +01:00
Olaoluwa Osuntokun
a7cb3334b4 Merge pull request #199 from starius/fix-flacky-tests
hashmail: fix flacky tests
2025-12-17 16:55:31 -08:00
Boris Nagaev
e734b4a068 hashmail: block until stream is freed
Fix flaky tests. Reproducer:
go test -run TestHashMailServerReturnStream -count=20

TestHashMailServerReturnStream fails because the test cancels a read stream
and immediately dials RecvStream again expecting the same stream to be handed
out once the server returns it. The hashmail server implemented
RequestReadStream/RequestWriteStream with a non-blocking channel poll and
returned "read/write stream occupied" as soon as the mailbox was busy. That
raced with the deferred ReturnStream call and the reconnect often happened
before the stream got pushed back, so clients received the occupancy error
instead of the context cancellation they triggered.

Teach RequestReadStream/RequestWriteStream to wait for the stream to become
available (or the caller's context / server shutdown) with a bounded timeout.
If the wait expires we still return the "... stream occupied" error, so callers
that legitimately pile up can see that signal. The new streamAcquireTimeout
constant documents the policy, and the blocking select removes the race, so
reconnect attempts now either succeed or surface the original context error.
2025-11-26 23:38:00 -03:00
Boris Nagaev
bf020ea103 hashmail: isolate server per test
Register the Aperture instance created in setupAperture with t.Cleanup so
that every test stops its own server even if it fails. This keeps the global
HashMail stream map clean and prevents TestHashMailServerLargeMessage from
inheriting leftover streams from TestHashMailServerReturnStream.

This prevents cascading test failures, when a failure in one test is replicated
as many failures in many tests, complicating debugging from logs.
2025-11-26 22:26:18 -03:00
Olaoluwa Osuntokun
92e54ece11 Merge pull request #198 from starius/fix-empty-domain
aperture: filter empty TLS SAN hostnames
2025-11-26 11:19:53 -08:00
Boris Nagaev
e9515c1ddd aperture: filter empty TLS SAN hostnames
Go 1.25 tightened x509 validation and now rejects empty dNSName entries, causing
the default self-signed cert generation to fail when ServerName is left unset
(`x509: SAN dNSName is malformed`). Filter out empty host names before calling
cert.GenCertPair and reuse the same SAN list when renewing, allowing the default
config to keep working. Add a unit test that reproduces the failure.
2025-11-26 15:02:01 -03:00
Slyghtning
fc00f171a8 Merge pull request #197 from lightninglabs/dependabot/go_modules/golang.org/x/crypto-0.45.0
build(deps): bump golang.org/x/crypto from 0.36.0 to 0.45.0
2025-11-20 11:48:44 +01:00
Slyghtning
092da9d450 linter: fix context package 2025-11-20 11:08:20 +01:00
dependabot[bot]
e351fa6928 build(deps): bump golang.org/x/crypto from 0.36.0 to 0.45.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.36.0 to 0.45.0.
- [Commits](https://github.com/golang/crypto/compare/v0.36.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-20 01:44:55 +00:00
András Bánki-Horváth
68aa32afef Merge pull request #196 from lightninglabs/dependabot/go_modules/github.com/opencontainers/runc-1.2.8
build(deps): bump github.com/opencontainers/runc from 1.2.0 to 1.2.8
2025-11-05 19:20:21 +01:00
dependabot[bot]
9b2bd207df build(deps): bump github.com/opencontainers/runc from 1.2.0 to 1.2.8
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.2.0 to 1.2.8.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Changelog](https://github.com/opencontainers/runc/blob/v1.2.8/CHANGELOG.md)
- [Commits](https://github.com/opencontainers/runc/compare/v1.2.0...v1.2.8)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-version: 1.2.8
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-05 16:49:46 +00:00
Slyghtning
2779c9ef6c Merge pull request #194 from lightninglabs/dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
2025-08-26 16:07:55 +02:00
Slyghtning
4093998f85 Merge pull request #170 from shaojunda/challenger/start-call
challenger: remove redundant Start() call in NewLNCChallenger
2025-08-26 16:01:18 +02:00
dependabot[bot]
e31a59b148 build(deps): bump github.com/go-viper/mapstructure/v2
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-21 15:32:28 +00:00
Oliver Gugger
7e5d505edd Merge pull request #190 from hieblmi/bump-linter
linter: upgrade `golangci-lint` to v2
2025-08-20 06:48:48 -06:00
Slyghtning
536bc0d241 linter: fix lint issues after linter v2 update 2025-08-20 14:42:42 +02:00
Slyghtning
d4884d5aee linter: migrate .golangci.yml to v2
The migration was done via:
golangci-lint migrate --skip-validation
2025-08-20 14:42:41 +02:00
Slyghtning
049be3eb04 linter: update dolangci-lint to v2 2025-08-20 07:03:35 +02:00
Olaoluwa Osuntokun
666de67808 Merge pull request #189 from hieblmi/bump-go
gomod: bump go to v1.24.6
2025-08-19 18:02:46 -07:00
Slyghtning
200a203d22 gomod: bump go to v1.24.6 2025-08-19 15:44:19 +02:00
Oliver Gugger
5b83c503e9 Merge pull request #187 from lightninglabs/fix-rpc-check
proxy+pricesrpc: fix RPC check by bumping Golang version
2025-08-07 03:22:33 -06:00
Oliver Gugger
d365f0cd79 proxy+pricesrpc: fix RPC check by bumping Golang version 2025-08-07 11:11:29 +02:00
Oliver Gugger
57dee6953d Merge pull request #186 from bhandras/go-bump-v1.23.12
build: bump go to v1.23.12
2025-08-07 03:09:17 -06:00
Andras Banki-Horvath
84452ffdf4 build: bump go to v1.23.12 2025-08-07 10:31:32 +02:00
Oliver Gugger
72d880d04b Merge pull request #185 from lightninglabs/dependabot/go_modules/tools/github.com/go-viper/mapstructure/v2-2.3.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.3.0 in /tools
2025-06-30 10:13:04 +02:00
dependabot[bot]
132d0143e5 build(deps): bump github.com/go-viper/mapstructure/v2 in /tools
---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.3.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 07:56:49 +00:00
Oliver Gugger
e483545f04 Merge pull request #184 from lightninglabs/dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.3.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2.3.0
2025-06-30 08:15:31 +02:00
dependabot[bot]
1100d173c1 build(deps): bump github.com/go-viper/mapstructure/v2
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.3.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.3.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-27 16:50:19 +00:00
Olaoluwa Osuntokun
3d991cec59 Merge pull request #181 from starius/bump-lightning-node-connect
update lightning-node-connect
2025-06-18 17:56:58 -07:00
Boris Nagaev
c99b44efd1 update lightning-node-connect
Include https://github.com/lightninglabs/lightning-node-connect/pull/116
It replaced a deprecated and removed dependency (nhooyr.io/websocket) with
an updated version.

Fix building with GOPROXY=direct.
2025-06-10 15:29:02 -03:00
Oliver Gugger
a990f62319 Merge pull request #180 from hieblmi/fix-shutdown-panic
challanger: fix shutdown panic
v0.3.14-beta
2025-05-27 20:38:41 +02:00
Slyghtning
6ee08290c5 challanger: cancel inv context when strictly verifying inv states 2025-05-27 20:30:18 +02:00
Oliver Gugger
c44ae45a07 Merge pull request #179 from lightninglabs/bump-lnd-version
GitHub+Docker: bump Golang version used
v0.3.13-beta
2025-05-26 13:52:00 +02:00
Oliver Gugger
b35b2b2742 GitHub+Docker: bump Golang version used 2025-05-26 13:42:43 +02:00
Oliver Gugger
8e175f9150 Merge pull request #178 from lightninglabs/lnd-19
mod: bump lnd, use latest modularized LNC
v0.3.12-beta
2025-05-26 13:19:17 +02:00
Oliver Gugger
491c0be94e multi: bump lnd, use latest modularized LNC 2025-05-26 12:49:05 +02:00
András Bánki-Horváth
20564d4a1d Merge pull request #172 from djkazic/aggregated-session-stats
aperture: internally aggregate session statistics to reduce cardinality
v0.3.11-beta
2025-05-22 16:54:45 +02:00
djkazic
eab9d755b6 fix: comment punctuation and shutdown of ticker 2025-05-21 11:28:34 -04:00
djkazic
7233c25bce aperture: internally aggregate session statistics to reduce cardinality 2025-05-19 12:40:24 -04:00