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