package socket import ( "tunnel/pkg/server/env" "tunnel/pkg/server/queue" ) type loopSocket struct{} type loopChannel struct { c chan queue.Q q chan error } func (c *loopChannel) Send(wq queue.Q) error { c.c <- wq return <-c.q } func (c *loopChannel) Recv(rq queue.Q) error { defer close(c.q) return queue.Copy(rq, <-c.c) } func (c *loopChannel) String() string { return "loop" } func (c *loopChannel) Close() error { return nil } func (s *loopSocket) Open(env.Env) (Channel, error) { return &loopChannel{make(chan queue.Q), make(chan error)}, nil } func (s *loopSocket) String() string { return "loop" } func (s *loopSocket) Close() { } func newLoopSocket() (S, error) { return &loopSocket{}, nil }