forked from Elara6331/itd
		
	Allow API client to be made from connection
This commit is contained in:
		| @@ -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() | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user