TUN-528: Move cloudflared into a separate repo

This commit is contained in:
Areg Harutyunyan
2018-05-01 18:45:06 -05:00
parent e8c621a648
commit d06fc520c7
4726 changed files with 1763680 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
{{with .Annotations.Doc -}}
// {{.}}
{{end -}}
type {{.Node.Name}} uint16
{{ template "_typeid" .Node }}
{{with .EnumValues -}}
// Values of {{$.Node.Name}}.
const (
{{range . -}}
{{.FullName}} {{$.Node.Name}} = {{.Val}}
{{end}}
)
// String returns the enum's constant name.
func (c {{$.Node.Name}}) String() string {
switch c {
{{range . -}}
{{if .Tag}}case {{.FullName}}: return {{printf "%q" .Tag}}
{{end}}
{{- end}}
default: return ""
}
}
// {{$.Node.Name}}FromString returns the enum value with a name,
// or the zero value if there's no such value.
func {{$.Node.Name}}FromString(c string) {{$.Node.Name}} {
switch c {
{{range . -}}
{{if .Tag}}case {{printf "%q" .Tag}}: return {{.FullName}}
{{end}}
{{- end}}
default: return 0
}
}
{{end}}
type {{.Node.Name}}_List struct { {{$.G.Capnp}}.List }
func New{{.Node.Name}}_List(s *{{$.G.Capnp}}.Segment, sz int32) ({{.Node.Name}}_List, error) {
l, err := {{.G.Capnp}}.NewUInt16List(s, sz)
return {{.Node.Name}}_List{l.List}, err
}
func (l {{.Node.Name}}_List) At(i int) {{.Node.Name}} {
ul := {{.G.Capnp}}.UInt16List{List: l.List}
return {{.Node.Name}}(ul.At(i))
}
func (l {{.Node.Name}}_List) Set(i int, v {{.Node.Name}}) {
ul := {{.G.Capnp}}.UInt16List{List: l.List}
ul.Set(i, uint16(v))
}