quiz

package
v0.0.0-...-ae80017 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidNetwork unable to parse network.
	ErrInvalidNetwork = errors.New("unable to parse network")
	// ErrInvalidQuestionKind invalid question kind.
	ErrInvalidQuestionKind = errors.New("invalid question kind")
)

Functions

func ValidQuestionKind

func ValidQuestionKind(kind string) bool

ValidQuestionKind returns true if the kind is valid.

Types

type Question

type Question struct {
	ID      string `json:"id"`
	IP      string `json:"ip"`
	Network string `json:"network"`
	Kind    string `json:"kind"`
	TTL     int64  `json:"ttl"`
}

Question represents a subnet question.

func NewQuestion

func NewQuestion(ip, network, kind string) *Question

NewQuestion returns a new randomly generated question struct. The fields can be overwritten by parameters.

func (*Question) Solution

func (q *Question) Solution() string

Solution looks up the function required to provide the solution based upon the question kind, transforms the question into a solvable format and solves.

func (*Question) String

func (q *Question) String() string

Jump to

Keyboard shortcuts

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