dtn7 / dtn7-gold

Delay-tolerant networking software suite, Bundle Protocol Version 7 (deprecated)
https://dtn7.github.io/
Other
78 stars 14 forks source link

Bundle Builder Documentation example not working #3

Closed gh0st42 closed 5 years ago

gh0st42 commented 5 years ago

The example for the bundle builder is not uptodate: https://godoc.org/github.com/dtn7/dtn7/bundle#BundleBuilder

bndl, err := bundle.Builder().
  CRC(bundle.CRC32).
  Source("dtn://src/").
  Destination("dtn://dest/").
  CreationTimestampNow().
  Lifetime("30m").
  HopCountBlock(64).
  PayloadBlock("hello world!").
  Build()

This leads to an error: binary.Write: invalid type string

The problem is the PayloadBlock which is given a string but needs a byte slice(e.g. []byte("hello world")

oxzi commented 5 years ago

Thanks!