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>
21 lines
313 B
Go
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
|
|
}
|