rpcfetch/io_unix.go
Ophestra Umiker 4e1e343081
library: io: implement client type and I/O methods
Path discovery is ported directly from Discord's C++ example, Windows has a crazy looking socket path that needs special syscall magic to dial, so we'll put that off for the time being.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-06-19 23:11:44 +09:00

21 lines
313 B
Go

package rpcfetch
import (
"net"
"time"
)
func (d *Client) dial() error {
if d.dialed {
panic("attempted to dial on open client")
}
if conn, err := net.DialTimeout("unix", sockPath()+"/discord-ipc-0", 5*time.Second); err != nil {
return err
} else {
d.Conn = conn
d.dialed = true
}
return nil
}