implemented pledge and unveil
This commit is contained in:
parent
68d82bd961
commit
37ecf9a192
3 changed files with 39 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ import (
|
|||
|
||||
type Client struct {
|
||||
endpoint string
|
||||
unix string
|
||||
httpClient *http.Client
|
||||
dialer *net.Dialer
|
||||
dialerFunc func(ctx context.Context, network, addr string) (net.Conn, error)
|
||||
|
|
@ -50,6 +51,7 @@ func WithEndpoint(endpoint string) ClientOption {
|
|||
return client.dialer.DialContext(ctx, "unix", u.Path)
|
||||
}
|
||||
client.endpoint = "http://unix"
|
||||
client.unix = u.Path
|
||||
return
|
||||
}
|
||||
client.dialerFunc = client.dialer.DialContext
|
||||
|
|
@ -189,6 +191,10 @@ func NewClient(options ...ClientOption) *Client {
|
|||
return client
|
||||
}
|
||||
|
||||
func (c *Client) IsUnix() (socket string, ok bool) {
|
||||
return c.unix, c.unix != ""
|
||||
}
|
||||
|
||||
func (c *Client) NewRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error) {
|
||||
url := c.endpoint + path
|
||||
req, err := http.NewRequest(method, url, body)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue