38 lines
603 B
Go
38 lines
603 B
Go
package meowlib
|
|
|
|
import (
|
|
"crypto/tls"
|
|
|
|
"github.com/go-resty/resty/v2"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
type Https struct {
|
|
url string
|
|
}
|
|
|
|
func (https *Https) Send(msg []byte) ([]byte, error) {
|
|
client := resty.New().SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
|
|
|
|
resp, err := client.R().
|
|
SetHeader("Content-Type", "application/json").
|
|
SetBody(msg).
|
|
Post(https.url + "/message/add/")
|
|
if err != nil {
|
|
log.Error().Msg(err.Error())
|
|
}
|
|
return resp.Body(), err
|
|
}
|
|
|
|
func (https *Https) Start(callback *func() []InternalMessage) {
|
|
for {
|
|
|
|
}
|
|
}
|
|
|
|
func (https *Https) Stop() {
|
|
for {
|
|
|
|
}
|
|
}
|