-
Notifications
You must be signed in to change notification settings - Fork 4
Tried Unix Domain Socket backend... #2
Copy link
Copy link
Open
Description
Hi, how do i make this work?
It's returning gibberish. Any solutions to make uds work too?
func forwardTcp(conn net.Conn, connectTo string) {
if debug {
log.Print("Accepted connection\n")
}
//fwd, err := net.DialTimeout("tcp", connectTo, timeout)
addrunix, err := net.ResolveUnixAddr("unix", connectTo)
fwd, err := net.DialUnix("unix", nil, addrunix)
if err != nil {
log.Printf("Conection to `%s` failed: %v\n", connectTo, err)
conn.Close()
return
}
close := func() {
fwd.Close()
conn.Close()
}
go func() {
defer close()
w, err := io.Copy(fwd, conn)
if debug {
log.Printf("Incoming TCP connection closed: %v; %v bytes forwarded\n", err, w)
}
}()
go func() {
defer close()
w, err := io.Copy(conn, fwd)
if debug {
log.Printf("Outgoing TCP connection closed: %v; %v bytes forwarded\n", err, w)
}
}()
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels