package module import ( "tunnel/pkg/server/queue" "encoding/hex" ) func hexEncoder(rq, wq queue.Q) error { enc := hex.NewEncoder(wq.Writer()) for b := range rq { enc.Write(b) } return nil } func hexDecoder(rq, wq queue.Q) error { r := hex.NewDecoder(rq.Reader()) w := wq.Writer() return queue.IoCopy(r, w) } func init() { register("hex", pipe(hexEncoder)) register("unhex", pipe(hexDecoder)) }