Allow API client to be made from connection
This commit is contained in:
parent
63cacded4a
commit
31c5c51b87
@ -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