provider

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cpp        string = "cpp"
	Cpp14             = "cpp14"
	Java              = "java"
	Java8             = "java8"
	Java15            = "java15"
	Python            = "python"
	Python3           = "python3"
	Perl              = "perl"
	Haskell           = "haskell"
	Clojure           = "clojure"
	ObjectiveC        = "objectivec"
	Pypy              = "pypy"
	Pypy3             = "pypy3"
	C                 = "c"
	Csharp            = "csharp"
	JavaScript        = "javascript"
	Ruby              = "ruby"
	Swift             = "swift"
	Golang            = "golang"
	Scala             = "scala"
	Kotlin            = "kotlin"
	Rust              = "rust"
	Php               = "php"
	TypeScript        = "typescript"
	Racket            = "racket"
	Erlang            = "erlang"
	Elixir            = "elixir"
	Bash              = "bash"
)

Variables

This section is empty.

Functions

func CookieJarFromMap

func CookieJarFromMap(m map[string]string, url *url.URL) (http.CookieJar, error)

func CookieJarFromReader

func CookieJarFromReader(reader io.Reader, url *url.URL, filter []string) (http.CookieJar, error)

func DecodeSolution

func DecodeSolution(backend string, reader io.Reader) (*string, error)

func EncodeChallenge

func EncodeChallenge(backend string, lang Lang, filters Filters, challenge Challenge, writer io.StringWriter) error

Types

type BackendConfig

type BackendConfig struct {
	Csrf       string `mapstructure:"csrf"`
	CsrfHeader string `mapstructure:"csrf-header"`
	Session    string `mapstructure:"session"`
}

type Challenge

type Challenge interface {
	Snippet(Lang) (string, error)
	Prompt() string
	Files() (map[string]string, error)
	Identify() Filters
}

type Config

type Config struct {
	Backend map[string]BackendConfig `mapstructure:"backend"`
}

type ErrorReport

type ErrorReport struct {
	ErrorClass string
	ErrorMsg   string
	CtxHeader  string
	CtxMsg     string
}

func NewErrorReport

func NewErrorReport(cls string, msg string, header string, content string) ErrorReport

type Filters

type Filters struct {
	// contains filtered or unexported fields
}

func ParseFilters

func ParseFilters(s string) *Filters

func (*Filters) AddFilter

func (filters *Filters) AddFilter(name string, value string) error

func (*Filters) GetFilter

func (filters *Filters) GetFilter(name string) (string, error)

func (*Filters) GetFilterOrDefault

func (filters *Filters) GetFilterOrDefault(name string) string

func (*Filters) Render

func (filters *Filters) Render(buf io.StringWriter) error

func (*Filters) Update

func (filters *Filters) Update(other *Filters)

type Lang

type Lang struct {
	// contains filtered or unexported fields
}

func ParseExt

func ParseExt(ext string) (*Lang, error)

func ParseLang

func ParseLang(s string) (*Lang, error)

func (*Lang) Comment

func (lang *Lang) Comment() (string, string, string, string)

func (*Lang) Ext

func (lang *Lang) Ext() string

func (*Lang) Is

func (lang *Lang) Is(s string) bool

func (*Lang) Pretty

func (lang *Lang) Pretty() string

func (*Lang) String

func (lang *Lang) String() string

type Provider

type Provider interface {
	Configure(BackendConfig) error
	IsSignedIn() (bool, error)
	GetChallenge(Filters) (Challenge, error)
	FindNextChallenge(Filters) (Filters, error)
	Submit(Filters, Lang, string) (SubmissionReport, error)
}

type SubmissionReport

type SubmissionReport interface {
	HasSucceeded() bool
	Identify() string
	Statistics() SubmissionStatistics
	ErrorReport() *ErrorReport
}

type SubmissionStatistics

type SubmissionStatistics struct {
	TotalTestCases    uint64
	Runtime           string
	RuntimePercentile float64
	Memory            string
	MemoryPercentile  float64
	Score             string
	MaxScore          string
}

func NewStatistics

func NewStatistics() SubmissionStatistics

type TransportClient

type TransportClient struct {
	CsrfToken       string
	CsrfTokenHeader string
	// contains filtered or unexported fields
}

func NewTransportClient

func NewTransportClient(base url.URL) TransportClient

func (*TransportClient) Do

func (client *TransportClient) Do(method string, path string, input interface{}, output interface{}) error

func (*TransportClient) DoQuery

func (client *TransportClient) DoQuery(operationName string, query string, variables interface{}, output interface{}) error

func (*TransportClient) RawDo

func (client *TransportClient) RawDo(r *http.Request) (*http.Response, error)

func (*TransportClient) ResolveReference

func (client *TransportClient) ResolveReference(path string) (*url.URL, error)

func (*TransportClient) SetCookieJar

func (client *TransportClient) SetCookieJar(jar http.CookieJar)

func (*TransportClient) SetCookies

func (client *TransportClient) SetCookies(cookies map[string]string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL