Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRedirect = errors.New("No redirect to challenge page.") ErrParseFailed = errors.New("Failed to parse challenge from HTML data tags.") )
Functions ¶
func Submit ¶
func Submit(ctx context.Context, hc http.Client, s Solution, redirect string) (*http.Response, error)
Submit a Solution for a Challenge.
If redirect is empty, "/" is used as a sensible default. Auth cookies get set automatically in http.Client's CookieJar. The *http.Response is provided to support more advanced setups. The auth token can also be found in its Body.
Types ¶
type Challenge ¶
type Challenge struct {
Salt string // Challenge salt from server.
Diff uint32 // Difficulty level.
Steps int8 // Each step consists of a Challenge and a Solution. More than 1 may be required.
// contains filtered or unexported fields
}
func NewChallenge ¶
Request new Tartarus challenge from provided host.
type ErrInvalidSolution ¶
type ErrInvalidSolution struct {
// contains filtered or unexported fields
}
func (*ErrInvalidSolution) Error ¶
func (e *ErrInvalidSolution) Error() string
type Solution ¶
type Solution struct {
Hash []byte // Not required in POST, but provided for reference.
Salt string // Challenge salt.
Nonce uint32 // Solution nonce. This is the "answer" to the problem.
Redirect string // Relative path to redirect to after Solution is accepted.
Steps int8 // Steps, as described in Challenge.
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.