diff options
| author | Mikhail Osipov <mike.osipov@gmail.com> | 2020-12-16 15:27:48 +0300 |
|---|---|---|
| committer | Mikhail Osipov <mike.osipov@gmail.com> | 2020-12-16 15:27:48 +0300 |
| commit | 6fed9dd0dd62718f78eca11e30a71c2712636fbd (patch) | |
| tree | 8d1f90b96efbe8ea8aea350c283325adc216ef9d /pkg/server/hook/hex.go | |
| parent | 050ea053dd549f0dd01beddfcd74989858391fd7 (diff) | |
hook and socket args check fix, tests
Diffstat (limited to 'pkg/server/hook/hex.go')
| -rw-r--r-- | pkg/server/hook/hex.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/pkg/server/hook/hex.go b/pkg/server/hook/hex.go index bc71bf2..362dbd4 100644 --- a/pkg/server/hook/hex.go +++ b/pkg/server/hook/hex.go @@ -2,14 +2,13 @@ package hook import ( "encoding/hex" - "tunnel/pkg/server/env" - "tunnel/pkg/server/opts" + "tunnel/pkg/server/queue" ) -type hexHook struct{} +type hexPipe struct{} -func (hexHook) Send(rq, wq queue.Q) error { +func (hexPipe) Send(rq, wq queue.Q) error { enc := hex.NewEncoder(wq.Writer()) for b := range rq { @@ -19,19 +18,11 @@ func (hexHook) Send(rq, wq queue.Q) error { return nil } -func (hexHook) Recv(rq, wq queue.Q) error { +func (hexPipe) Recv(rq, wq queue.Q) error { r := hex.NewDecoder(rq.Reader()) return queue.IoCopy(r, wq.Writer()) } -func (h hexHook) Open(env.Env) (interface{}, error) { - return h, nil -} - -func newHexHook(opts.Opts) (hook, error) { - return hexHook{}, nil -} - func init() { - register("hex", newHexHook) + registerPipe("hex", hexPipe{}) } |
