cmdutils

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllowBigBlockOptionName = "allow-big-block"
	SoftBlockLimit          = 1024 * 1024 // https://github.com/ipfs/kubo/issues/7421#issuecomment-910833499
	MaxPinNameBytes         = 255         // Maximum number of bytes allowed for a pin name
)

Variables

View Source
var AllowBigBlockOption cmds.Option

Functions

func CheckBlockSize

func CheckBlockSize(req *cmds.Request, size uint64) error

func CheckCIDSize

func CheckCIDSize(req *cmds.Request, c cid.Cid, dagAPI coreiface.APIDagService) error

func CleanAndTrim added in v0.38.0

func CleanAndTrim(str string) string

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 PathOrCidPath added in v0.24.0

func PathOrCidPath(str string) (path.Path, error)

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

func ValidatePinName(name string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL