forked from Elara6331/itd
Allow API client to be made from connection
This commit is contained in:
parent
b614138f6b
commit
0cbd6a48ae
@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"go.arsenm.dev/lrpc/client"
|
||||
@ -25,6 +26,12 @@ func New(sockPath string) (*Client, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewFromConn(conn io.ReadWriteCloser) *Client {
|
||||
return &Client{
|
||||
client: client.New(conn, codec.Default),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) Close() error {
|
||||
return c.client.Close()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user