28 lines
361 B
Go
28 lines
361 B
Go
|
package x3_client
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"net/http/cookiejar"
|
||
|
)
|
||
|
|
||
|
type X3Client struct {
|
||
|
Host string
|
||
|
|
||
|
httpClient *http.Client
|
||
|
}
|
||
|
|
||
|
func NewX3Client(host, port string) (*X3Client, error) {
|
||
|
jar, err := cookiejar.New(nil)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return &X3Client{
|
||
|
Host: host + ":" + port,
|
||
|
|
||
|
httpClient: &http.Client{
|
||
|
Jar: jar,
|
||
|
},
|
||
|
}, nil
|
||
|
}
|