diff options
Diffstat (limited to 'pkg/server/hook/b64.go')
| -rw-r--r-- | pkg/server/hook/b64.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/pkg/server/hook/b64.go b/pkg/server/hook/b64.go index fce42a0..c6637e5 100644 --- a/pkg/server/hook/b64.go +++ b/pkg/server/hook/b64.go @@ -2,17 +2,16 @@ package hook import ( "encoding/base64" + "tunnel/pkg/netstring" - "tunnel/pkg/server/env" - "tunnel/pkg/server/opts" "tunnel/pkg/server/queue" ) var b64Enc = base64.RawStdEncoding -type b64Hook struct{} +type b64Pipe struct{} -func (b64Hook) Send(rq, wq queue.Q) error { +func (b64Pipe) Send(rq, wq queue.Q) error { e := netstring.NewEncoder(wq.Writer()) for b := range rq { @@ -22,7 +21,7 @@ func (b64Hook) Send(rq, wq queue.Q) error { return nil } -func (b64Hook) Recv(rq, wq queue.Q) error { +func (b64Pipe) Recv(rq, wq queue.Q) error { d := netstring.NewDecoder(rq.Reader()) for { @@ -39,14 +38,6 @@ func (b64Hook) Recv(rq, wq queue.Q) error { } } -func (h b64Hook) Open(env.Env) (interface{}, error) { - return h, nil -} - -func newB64Hook(opts.Opts) (hook, error) { - return b64Hook{}, nil -} - func init() { - register("b64", newB64Hook) + registerPipe("b64", b64Pipe{}) } |
