package module import ( "tunnel/pkg/server/queue" "tunnel/pkg/server/opts" "tunnel/pkg/server/env" ) type auth struct { secret string } type authModule struct{} func (a *auth) Send(rq, wq queue.Q) error { return queue.Copy(rq, wq) } func (a *auth) Recv(rq, wq queue.Q) error { return queue.Copy(rq, wq) } func (m authModule) Open(env env.Env) (Pipe, Pipe) { a := &auth{env.Get("secret")} return a.Send, a.Recv } func init() { register("auth", func (opts.Opts, env.Env) (module, error) { return authModule{}, nil }) }