Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 state

Back to all declarations

samples

[]string (len=6)

samples are valid, canonical encodings, one per type plus the composites.

Open
OID
0d46a5…3d5a:4
samples details (len=6)

+6 more Inspect slice

torrent

untyped string

torrent is the shape the format exists for: a tracker announce beside an info dictionary whose re-encoding is what gets hashed.

Value

"d8:announce21:udp://tracker.example4:infod6:lengthi262144e4:name8:disk.img12:piece lengthi16384eee"

MaxInput

untyped bigint

MaxInput bounds what this page will decode. The library accepts up to bencode.MaxLen bytes, but a Render runs under the chain's query gas meter and gnoweb does not bound a render argument, so the page stops well short of the library's own limit. 512 bytes is more than anyone pastes by hand.

Value

(512 <untyped> bigint)

rejected

[]struct{...} (len=6)

rejected are inputs a sloppy decoder accepts and silently rewrites. Each one would change the digest of whatever contained it.

Open
OID
0d46a5…3d5a:6
rejected details (len=6)

+6 more Inspect slice

Render

func(path string) string

Render renders the demo for gnoweb. Render("") / Render("/") -> the types, the round trip, the refusals Render("/<bencoded value>") -> decode that input and show the tree

Open
OID
0d46a5…3d5a:13
Render details

Inspect func

summarize

func(v *v0.Value) string

summarize describes a value in one cell, without recursing.

Open
OID
0d46a5…3d5a:15
summarize details

Inspect func

tree

func(b *strings.Builder, v *v0.Value, depth int)

tree writes a value as a nested markdown list. It takes the builder rather than returning a string: a dictionary of a few hundred entries is reachable inside MaxInput, and += over that many lines copies the page once per line.

Open
OID
0d46a5…3d5a:16
tree details

Inspect func

leaf

func(v *v0.Value) string

leaf renders an int or a string as one line.

Open
OID
0d46a5…3d5a:17
leaf details

Inspect func

parseArg

func(path string) string

parseArg takes the whole render path as the value to decode: a bencoded string contains colons and digits, and splitting on them would mangle it. Only the routing slash comes off. Trimming whitespace would eat a byte the caller declared the length of, so "6:hello " would arrive as a five byte string claiming six and be rejected for the trim rather than for itself.

Open
OID
0d46a5…3d5a:18
parseArg details

Inspect func
samples : []string (len=6) Inspect
torrent : untyped string ="d8:announce21:udp://tracker.example4:infod6:lengthi262144e4:name8:disk.img12:piece lengthi16384eee"
MaxInput : untyped bigint =(512 <untyped> bigint)
rejected : []struct{...} (len=6) Inspect
Render : func(path string) string Inspect
summarize : func(v *v0.Value) string Inspect
tree : func(b *strings.Builder, v *v0.Value, depth int) Inspect
leaf : func(v *v0.Value) string Inspect
parseArg : func(path string) string Inspect