Documentation
¶
Index ¶
- Constants
- Variables
- func PrettyPrint(v any) string
- type Attributes
- type Client
- func (c *Client) Clone(f *Fiddle) (*Fiddle, error)
- func (c *Client) Create(f *Fiddle, opts ...RequestOptionFunc) (*Fiddle, error)
- func (c *Client) Do(req *http.Request, v any) (*http.Response, error)
- func (c *Client) Execute(f *Fiddle, opts ExecuteOptions) (*StreamEvent, error)
- func (c *Client) ExecuteIter(f *Fiddle, opts ExecuteOptions) (iter.Seq2[*StreamEvent, error], error)
- func (c *Client) Get(id string) (*Fiddle, bool, Lints, error)
- func (c *Client) Lock(f *Fiddle, password string) (string, error)
- func (c *Client) NewRequest(method, path string, body any, opts ...RequestOptionFunc) (*http.Request, error)
- func (c *Client) PurgeKey(f *Fiddle, key string) (bool, error)
- func (c *Client) Update(f *Fiddle, opts ...RequestOptionFunc) (*Fiddle, error)
- type ClientFetch
- type ComputeSource
- type Config
- type Event
- type ExecuteOptions
- type ExecuteResponse
- type Fiddle
- type FiddleError
- type Insight
- type Lint
- type LintStatus
- type Lints
- type Log
- type OriginFetch
- type Purge
- type Request
- type RequestOptionFunc
- type RequestOptions
- type Resp
- type Server
- type Source
- type StreamEvent
- type TestResult
- type UpdateResultEvent
- type VCLSource
- type WaitForSyncEvent
Constants ¶
View Source
const ( FiddleTypeVCL = "vcl" FiddleTypeJavaScript = "javascript" FiddleTypeGo = "go" FittleTypeRust = "rust" )
View Source
const ( MethodGet = "GET" MethodHead = "HEAD" MethodPost = "POST" MethodPut = "PUT" MethodPatch = "PATCH" MethodDelete = "DELETE" MethodOptions = "OPTIONS" MethodPurge = "PURGE" MethodInvalid = "INVALID" SourceIpClient = "client" SourceIpServer = "server" SourceIpChina = "cn" SourceIpGermany = "de" SourceIpJapan = "jp" SourceIpRussia = "ru" SourceIpBrazil = "br" SourceIpSouthAfrica = "za" SourceIpUnitedKingdon = "uk" SourceIpUnitedStates = "us" ConnectionTypeHTTP2 = "h2" ConnectionTypeHTTP1TLS = "h1" ConnectionTypeHTTP1Plain = "http" )
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
func PrettyPrint ¶
Types ¶
type Attributes ¶
type Attributes struct { AlwaysMiss bool `json:"alwaysMiss,omitempty"` Backend string `json:"backend,omitempty"` IgnoreBusy bool `json:"ignoreBusy,omitempty"` IsESI bool `json:"isESI,omitempty"` IsH2 bool `json:"isH2,omitempty"` IsPush bool `json:"isPush,omitempty"` Method string `json:"method,omitempty"` Restarts int `json:"restarts,omitempty"` Return string `json:"return,omitempty"` URL string `json:"url,omitempty"` Hits int `json:"hits,omitempty"` Digest string `json:"digest,omitempty"` Age int `json:"age,omitempty"` SKeys string `json:"skeys,omitempty"` TTL int `json:"ttl,omitempty"` IsPCI bool `json:"isPCI,omitempty"` LastUse int `json:"lastuse,omitempty"` StaleExists bool `json:"staleExists,omitempty"` Status int `json:"status,omitempty"` State string `json:"state,omitempty"` StatusText string `json:"statusText,omitempty"` }
type Client ¶
type Client struct { UserAgent string // contains filtered or unexported fields }
func (*Client) Create ¶
func (c *Client) Create(f *Fiddle, opts ...RequestOptionFunc) (*Fiddle, error)
func (*Client) Execute ¶
func (c *Client) Execute(f *Fiddle, opts ExecuteOptions) (*StreamEvent, error)
Execute Fiddle and return the final StreamEvent.
func (*Client) ExecuteIter ¶
func (c *Client) ExecuteIter(f *Fiddle, opts ExecuteOptions) (iter.Seq2[*StreamEvent, error], error)
Execute Fiddle and return and iterator which will yield all the events produced during the execution.
func (*Client) NewRequest ¶
type ClientFetch ¶
type ClientFetch struct { Delay int `json:"delay"` IsRedirected bool `json:"isRedirected"` Req string `json:"req"` Complete bool `json:"complete"` Resp string `json:"resp"` RespType string `json:"respType"` IsText bool `json:"isText"` IsImage bool `json:"isImage"` PreviewType string `json:"previewType"` BodyPreview string `json:"bodyPreview"` BodyBytesReceived int `json:"bodyBytesReceived"` BodyChunkCount int `json:"bodyChunkCount"` Tests []TestResult `json:"tests"` Insights []Insight `json:"insights"` }
type ComputeSource ¶
type Event ¶
type Event struct { ReqID string `json:"reqID"` TraceID string `json:"traceID"` Time int `json:"time"` SeqIdx int `json:"seqIdx"` Attribs Attributes `json:"attribs"` Type string `json:"type"` FnName string `json:"fnName,omitempty"` IsAsync *bool `json:"isAsync,omitempty"` IsComplete *bool `json:"isComplete,omitempty"` Logs []Log `json:"logs,omitempty"` PrevAttribs Attributes `json:"prevAttribs,omitempty"` RanBoilerplate *bool `json:"ranBoilerplate,omitempty"` Server Server `json:"server,omitempty"` FetchID string `json:"fetchID,omitempty"` URL string `json:"url,omitempty"` Method string `json:"method,omitempty"` }
type ExecuteOptions ¶
type ExecuteOptions struct {
CacheID int
}
type ExecuteResponse ¶
type Fiddle ¶
type Fiddle struct { ID string `json:"id"` Title string `json:"title"` Type string `json:"type"` Description string `json:"description"` Origins []string `json:"origins"` Source Source `json:"src"` SourceVersion int `json:"srcVersion"` Requests []Request `json:"requests"` IsLocked bool `json:"isLocked"` LastEditor string `json:"lastEditor"` }
type FiddleError ¶
func (*FiddleError) Error ¶
func (e *FiddleError) Error() string
type LintStatus ¶
func (LintStatus) MarshalJSON ¶
func (ls LintStatus) MarshalJSON() ([]byte, error)
func (*LintStatus) UnmarshalJSON ¶
func (ls *LintStatus) UnmarshalJSON(data []byte) error
type Lints ¶
type Lints map[string]LintStatus
type OriginFetch ¶
type OriginFetch struct { ElapsedTime int `json:"elapsedTime"` FetchID string `json:"fetchID"` Insights []Insight `json:"insights"` OriginIdx int `json:"originIdx"` RemoteAddr string `json:"remoteAddr"` RemoteHost string `json:"remoteHost"` RemotePort int `json:"remotePort"` Req string `json:"req"` ReqID string `json:"reqID"` Resp string `json:"resp"` TraceID string `json:"traceID"` }
type Request ¶
type Request struct { Method string `json:"method"` Path string `json:"path"` Headers string `json:"headers"` Body string `json:"body"` Data map[string]any `json:"data"` // Uncertain of function EnableCluster bool `json:"enableCluster"` EnableShield bool `json:"enableShield"` UseFreshCache bool `json:"useFreshCache"` ConnType string `json:"connType"` SourceIP string `json:"sourceIP"` FollowRedirects bool `json:"followRedirects"` Tests string `json:"tests"` Delay int `json:"delay"` }
func NewRequest ¶
func NewRequest() Request
type RequestOptionFunc ¶
func WithPassword ¶
func WithPassword(pw string) RequestOptionFunc
type RequestOptions ¶
type RequestOptions struct {
// contains filtered or unexported fields
}
type Resp ¶
type Resp struct { Fiddle Fiddle `json:"fiddle"` Valid bool `json:"valid"` LintStatus map[string]LintStatus `json:"lintStatus"` }
type Source ¶
type Source struct { VCLSource ComputeSource }
type StreamEvent ¶
type StreamEvent struct { Type string `json:"-"` UpdateResultEvent WaitForSyncEvent }
type TestResult ¶
type UpdateResultEvent ¶
type UpdateResultEvent struct { ClientFetches map[string]ClientFetch `json:"clientFetches"` Events []Event `json:"events"` ExecHost string `json:"execHost"` ExecVersion int `json:"execVersion"` ID string `json:"id"` Insights []Insight `json:"insights"` OriginFetches map[string]OriginFetch `json:"originFetches"` PackageFile string `json:"packageFile"` RequestCount int `json:"requestCount"` StartTime int `json:"startTime"` }
type VCLSource ¶
type VCLSource struct { Init string `json:"init,omitempty"` Recv string `json:"recv,omitempty"` Fetch string `json:"fetch,omitempty"` Deliver string `json:"deliver,omitempty"` Hash string `json:"hash,omitempty"` Hit string `json:"hit,omitempty"` Miss string `json:"miss,omitempty"` Pass string `json:"pass,omitempty"` Log string `json:"log,omitempty"` }
type WaitForSyncEvent ¶
type WaitForSyncEvent struct { ServiceID string `json:"serviceID"` ServiceName string `json:"serviceName"` SavedVersion int `json:"savedVersion"` PublishedVersion int `json:"publishedVersion"` ExecutedVersion int `json:"executedVersion"` PublishedFiddle string `json:"publishedFiddle"` ExecutedFiddle string `json:"executedFiddle"` ReqHost string `json:"reqHost"` Status int `json:"status"` RetryCount int `json:"retryCount"` }
Click to show internal directories.
Click to hide internal directories.