feat: change project structure
This commit is contained in:
28
hsp/client/client.go
Normal file
28
hsp/client/client.go
Normal file
@ -0,0 +1,28 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/LandaMm/hsp-go/hsp"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
Duplex *hsp.PacketDuplex
|
||||
}
|
||||
|
||||
func NewClient() *Client {
|
||||
return &Client{
|
||||
Duplex: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) SendRequest(req *hsp.Request, address string) (*hsp.Response, error) {
|
||||
// TODO: Parse pathname
|
||||
conn, err := net.Dial("tcp", address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.Duplex = hsp.NewPacketDuplex(conn)
|
||||
}
|
||||
|
Reference in New Issue
Block a user