/
resp_tarpit.go
42 lines (34 loc) · 1.26 KB
/
resp_tarpit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Code generated by __generator__/interpreter.go at once
package builtin
import (
"github.com/ysugimoto/falco/interpreter/context"
"github.com/ysugimoto/falco/interpreter/function/errors"
"github.com/ysugimoto/falco/interpreter/value"
)
const Resp_tarpit_Name = "resp.tarpit"
var Resp_tarpit_ArgumentTypes = []value.Type{value.IntegerType, value.IntegerType}
func Resp_tarpit_Validate(args []value.Value) error {
if len(args) < 1 || len(args) > 2 {
return errors.ArgumentNotInRange(Resp_tarpit_Name, 1, 2, args)
}
for i := range args {
if args[i].Type() != Resp_tarpit_ArgumentTypes[i] {
return errors.TypeMismatch(Resp_tarpit_Name, i+1, Resp_tarpit_ArgumentTypes[i], args[i].Type())
}
}
return nil
}
// Fastly built-in function implementation of resp.tarpit
// Arguments may be:
// - INTEGER, INTEGER
// - INTEGER
// Reference: https://developer.fastly.com/reference/vcl/functions/miscellaneous/resp-tarpit/
func Resp_tarpit(ctx *context.Context, args ...value.Value) (value.Value, error) {
// Argument validations
if err := Resp_tarpit_Validate(args); err != nil {
return value.Null, err
}
// @TODO: currently we do not support tarpitting, so this function has no effect
// see: https://en.wikipedia.org/wiki/Tarpit_(networking)
return value.Null, nil
}