client

package
v0.0.0-...-bc7e45f Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package client provides networking capabilities and the generic Crack method that uses Cracker interface.

Index

Constants

View Source
const (
	WrongAnswer           = iota
	RuntimeError          = iota
	IdlenessLimitExceeded = iota
	MemoryLimitExceeded
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	http.Client `json:"-"`
	HostUrl     string                `json:"-"`           // as in https://codeforces.com, derived from contest_url
	MyUrl       string                `json:"my_url"`      // as in https://codeforces.com/contest/4/my
	ContestUrl  string                `json:"contest_url"` // as in https://codeforces.com/contest/4
	LangId      string                `json:"lang_id"`
	ContestId   string                `json:"contest_id"`
	ProblemId   string                `json:"problem_id"`
	Cases       compilation.TestCases `json:"test_cases"`
}

func (*Client) Crack

func (client *Client) Crack(source []byte, cracker Cracker) error

func (*Client) FindCSRF

func (client *Client) FindCSRF(URL string) (string, error)

func (*Client) Login

func (client *Client) Login(handleOrEmail string, password string) error

func (*Client) LoginUrl

func (client *Client) LoginUrl() string

func (*Client) PostSubmission

func (client *Client) PostSubmission(csrf string, source string) error

func (*Client) PrintCases

func (client *Client) PrintCases()

func (*Client) Submit

func (client *Client) Submit(csrf string, source string) (res SubmissionResult, err error)

func (*Client) SubmitUrl

func (client *Client) SubmitUrl() string

type Cracker

type Cracker interface {
	GetNextValue(client *Client, parts compilation.Parts) (int, error)
}

type SubmissionResult

type SubmissionResult struct {
	Verdict
	Time time.Duration
}

type TestEndError

type TestEndError struct{}

func (TestEndError) Error

func (TestEndError) Error() string

type ValueError

type ValueError struct{}

func (ValueError) Error

func (ValueError) Error() string

type Verdict

type Verdict int

Jump to

Keyboard shortcuts

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