Commit Graph

11 Commits

Author SHA1 Message Date
Marcin Rataj
93f8897d7c
feat(config): optional Gateway.MaxRangeRequestFileSize (#10997)
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Check / lint (push) Waiting to run
Docker Check / build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run
adds Gateway.MaxRangeRequestFileSize configuration to protect against CDN bugs
where range requests over certain sizes return entire files instead of requested
byte ranges, causing unexpected bandwidth costs.

- default: 0 (no limit)
- returns 501 Not Implemented for oversized range requests
- protects against CDNs like Cloudflare that ignore range requests over 5GiB

also introduces OptionalBytes type to reduce code duplication when handling
byte-size configuration values, replacing manual string parsing with humanize.ParseBytes.
migrates existing byte-size configs to use this new type.

Fixes: https://github.com/ipfs/boxo/issues/856
2025-11-11 18:54:43 -08:00
Kay
f12b372af9
style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
Marten Seemann
d2268793dc go-ipfs-config: feat: Swarm.RelayService (circuit v2) (#146)
* remove the EnableRelayHop option in the SwarmConfig

* add an option to disable the limited relay

* make the relay service resources configurable

* refactor: use custom types

This enables us to swap defaults in go-ipfs without touching the config
file generated during `ipfs init`

https://github.com/ipfs/go-ipfs-config/pull/146#discussion_r734728162
https://github.com/ipfs/go-ipfs-config/pull/146#discussion_r734728019

* use OptionalDuration in RelayService configuration

* fix: *OptionalInteger with omitempty

This removes null values from the config

* fix: Flag does not need to be a pointer

* refactor: flatten RelayService limits

this simplifies consumer code and removes nil footgun

* docs: clarify different relay types

* feat: flag for ForceReachability mode in libp2p (#150)

adds Internal.Libp2pForceReachability
needed for sharness tests in ipfs/go-ipfs#8522

Co-authored-by: Marcin Rataj <lidel@lidel.org>

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-11-13 03:07:14 -08:00
Marten Seemann
ba9d9f609c go-ipfs-config: fix: String method on the OptionalString (#153)
* fix: String method on the OptionalString
* test(OptionalString): empty string is preserved

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-10-29 17:21:53 +02:00
Adin Schmahmann
cdaa222b22 go-ipfs-config: feat: OptionalString type and UnixFSShardingSizeThreshold (#149)
* feat: add OptionalString type
* test: fix OptionalInteger test
* add Internal.UnixFSShardingSizeThreshold as optional string
* test: OptionalString null unmarshal with default
* fix: omitempty UnixFSShardingSizeThreshold

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-10-28 22:55:08 +02:00
Marten Seemann
2cf170d5fa go-ipfs-config: feat: add an OptionalDuration type (#148)
* feat: make it possible to define optional durations
* test: empty/default optional durations
does not crash if user restores default value and sets it to empty string ""

* refactor: use null in JSON
* refactor(duration): use JSON null as the default

Rationale:
https://github.com/ipfs/go-ipfs-config/pull/148#discussion_r736975879

* refactor: Duration → OptionalDuration

This makes it possible to use OptionalDuration with `json:",omitempty"`
so the null is not serialized to JSON, and get working WithDefault as well.

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-10-27 18:23:35 +02:00
Adin Schmahmann
ac81804c8c go-ipfs-config: feat: add an OptionalInteger type 2021-08-18 08:14:25 -04:00
Steven Allen
7ce67b8954 go-ipfs-config: feat: add WithDefault for flag/priority
This makes it easier to resolve these fields.
2020-06-15 19:19:01 -07:00
Steven Allen
dfe53cd5b6 go-ipfs-config: feat: add flag and priority types
These let us zero-encode "default" to "null" (and omit it with "omitempty") so
we don't have to hard code the default in the config.
2020-06-15 15:24:00 -07:00
Steven Allen
25a96cfb1b go-ipfs-config: feat: add and use a duration helper type 2020-04-14 20:04:40 -07:00
Steven Allen
3cd45d889a go-ipfs-config: add tests for the "Strings" type
(missed in my previous PR)
2018-12-13 16:03:29 -08:00