Documentation
¶
Index ¶
- Constants
- Variables
- func CheckBlockSize(req *cmds.Request, size uint64) error
- func CheckCIDSize(req *cmds.Request, c cid.Cid, dagAPI coreiface.APIDagService) error
- func CleanAndTrim(str string) string
- func CloneAddrInfo(ai peer.AddrInfo) peer.AddrInfo
- func PathOrCidPath(str string) (path.Path, error)
- func ValidatePinName(name string) error
Constants ¶
const ( AllowBigBlockOptionName = "allow-big-block" // SoftBlockLimit is the maximum block size for bitswap transfer. // If this value changes, update the "2MiB" strings in error messages below. SoftBlockLimit = 2 * 1024 * 1024 // https://specs.ipfs.tech/bitswap-protocol/#block-sizes MaxPinNameBytes = 255 // Maximum number of bytes allowed for a pin name )
Variables ¶
var AllowBigBlockOption cmds.Option
Functions ¶
func CheckCIDSize ¶
func CleanAndTrim ¶ added in v0.38.0
CleanAndTrim sanitizes untrusted strings from remote peers to prevent display issues across web UIs, terminals, and logs. It replaces control characters, format characters, and surrogates with U+FFFD (�), then enforces a maximum length of 128 runes.
This follows the libp2p identify specification and RFC 9839 guidance: replacing problematic code points is preferred over deletion as deletion is a known security risk.
func CloneAddrInfo ¶
CloneAddrInfo returns a copy of the AddrInfo with a cloned Addrs slice. This prevents data races if the sender reuses the backing array. See: https://github.com/ipfs/kubo/issues/11116
func PathOrCidPath ¶ added in v0.24.0
PathOrCidPath returns a path.Path built from the argument. It keeps the old behaviour by building a path from a CID string.
func ValidatePinName ¶ added in v0.38.0
ValidatePinName validates that a pin name does not exceed the maximum allowed byte length. Returns an error if the name exceeds MaxPinNameBytes (255 bytes).
Types ¶
This section is empty.