refactor: sync messages with spec draft (#435)
Work part of: https://github.com/ooni/probe/issues/1733 Spec draft: https://github.com/ooni/spec/pull/219
This commit is contained in:
parent
ce854e8ae1
commit
f2b6a5972f
8 changed files with 165 additions and 124 deletions
|
|
@ -8,22 +8,10 @@ import (
|
|||
"github.com/ooni/probe-cli/v3/internal/errorsx"
|
||||
)
|
||||
|
||||
// CtrlRequest is the request sent by the probe
|
||||
type CtrlRequest struct {
|
||||
HTTPRequest string `json:"url"`
|
||||
HTTPRequestHeaders map[string][]string `json:"headers"`
|
||||
Addrs []string `json:"addrs"`
|
||||
}
|
||||
|
||||
// ControlResponse is the response from the control service.
|
||||
type ControlResponse struct {
|
||||
URLMeasurements []*URLMeasurement `json:"urls"`
|
||||
}
|
||||
|
||||
// Control performs the control request and returns the response.
|
||||
func Control(
|
||||
ctx context.Context, sess model.ExperimentSession,
|
||||
thAddr string, creq CtrlRequest) (out ControlResponse, err error) {
|
||||
thAddr string, creq CtrlRequest) (out CtrlResponse, err error) {
|
||||
clnt := httpx.Client{
|
||||
BaseURL: thAddr,
|
||||
HTTPClient: sess.DefaultHTTPClient(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue