├── scripts ├── README.md ├── json2csv.py ├── build.py ├── get_repos.py ├── run_submissions.py └── post_issues.py ├── .gitignore ├── internal ├── docker │ ├── testdata │ │ ├── doggy.jpg │ │ ├── echo │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ ├── memory │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ ├── file │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ ├── game │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ │ └── counter │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ ├── player.go │ ├── Dockerfile │ ├── utils.go │ ├── builder.go │ ├── player_test.go │ ├── runner.go │ └── docker_test.go ├── game │ ├── field │ │ ├── testdata │ │ │ └── dense.txt │ │ ├── field.go │ │ ├── ship_field.go │ │ └── field_test.go │ ├── player_ext.go │ └── player.go ├── judge │ ├── mock.go │ ├── judge.go │ └── match.go └── utils │ ├── stopwatch.go │ └── stopwatch_test.go ├── README.md ├── Makefile ├── cmd └── server │ ├── utils.go │ ├── main.go │ └── server.go ├── go.mod ├── LICENSE └── go.sum /scripts/README.md: -------------------------------------------------------------------------------- 1 | thanks chatgpt 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | .env 3 | .cache 4 | -------------------------------------------------------------------------------- /internal/docker/testdata/doggy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrsobakin/itmournament/HEAD/internal/docker/testdata/doggy.jpg -------------------------------------------------------------------------------- /internal/docker/testdata/echo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | project(echo) 4 | 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") 6 | 7 | add_executable(echo main.cpp) 8 | -------------------------------------------------------------------------------- /internal/docker/testdata/memory/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | project(memory) 4 | 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") 6 | 7 | add_executable(memory main.cpp) 8 | -------------------------------------------------------------------------------- /internal/docker/testdata/echo/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | while (1) { 5 | std::string cmd; 6 | std::cin >> cmd; 7 | std::cout << cmd << std::endl; 8 | } 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /internal/docker/testdata/file/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | project(file) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED True) 7 | 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") 9 | 10 | add_executable(file main.cpp) 11 | -------------------------------------------------------------------------------- /internal/docker/testdata/game/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | project(game) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED True) 7 | 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") 9 | 10 | add_executable(game main.cpp) 11 | -------------------------------------------------------------------------------- /internal/docker/testdata/counter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | project(counter) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED True) 7 | 8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") 9 | 10 | add_executable(counter main.cpp) 11 | -------------------------------------------------------------------------------- /scripts/json2csv.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from pathlib import Path 3 | import pandas as pd 4 | 5 | input_path = Path(sys.argv[1]) 6 | output_path = input_path.with_suffix('.csv') 7 | 8 | df = pd.read_json(input_path) 9 | df.to_csv(output_path.open(mode='w'), encoding='utf-8', index=False, header=True) 10 | -------------------------------------------------------------------------------- /internal/docker/testdata/memory/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const size_t kSize = 128 * 1024 * 1024; 4 | 5 | int main() { 6 | char* arr = new char[kSize]; 7 | 8 | for (size_t i = 0; i < kSize; ++i) { 9 | arr[i] = 1; 10 | } 11 | 12 | std::cout << "ok" << std::endl; 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🤺 itmournament 2 | 3 | *As in `ITMO`, `tournament` and `mourn`.* 4 | 5 | Testing system for ITMO C++ battleship tournament. 6 | 7 | You'll have to have docker to run it. Also, add yourself to `docker` group to avoid running testing system as sudo. 8 | 9 | You use windows and want to run it? [Oh, geez, that's too bad](https://www.youtube.com/watch?v=NunTJ_k9M14). 10 | -------------------------------------------------------------------------------- /internal/docker/testdata/file/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | using namespace std::chrono_literals; 7 | 8 | std::ofstream f("/tmp/file.txt"); 9 | f << "test data"; 10 | f.close(); 11 | 12 | std::this_thread::sleep_for(2s); 13 | 14 | std::cout << "ok" << std::endl; 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /internal/game/field/testdata/dense.txt: -------------------------------------------------------------------------------- 1 | 10 10 2 | 4 h 0 0 3 | 1 h 5 0 4 | 3 h 7 0 5 | 4 v 0 2 6 | 3 h 2 2 7 | 2 h 6 2 8 | 3 v 9 2 9 | 2 h 2 4 10 | 4 v 5 4 11 | 2 v 7 4 12 | 4 v 3 6 13 | 2 v 9 6 14 | 2 h 0 7 15 | 1 h 7 7 16 | 2 h 0 9 17 | 2 h 5 9 18 | 2 h 8 9 19 | 20 | 4 4 4 4 . 1 . 3 3 3 21 | . . . . . . . . . . 22 | 4 . 3 3 3 . 2 2 . 3 23 | 4 . . . . . . . . 3 24 | 4 . 2 2 . 4 . 2 . 3 25 | 4 . . . . 4 . 2 . . 26 | . . . 4 . 4 . . . 2 27 | 2 2 . 4 . 4 . 1 . 2 28 | . . . 4 . . . . . . 29 | 2 2 . 4 . 2 2 . 2 2 30 | -------------------------------------------------------------------------------- /internal/docker/testdata/counter/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() { 6 | uint64_t counter = 0; 7 | 8 | auto start = std::chrono::high_resolution_clock::now(); 9 | 10 | while (true) { 11 | auto now = std::chrono::high_resolution_clock::now(); 12 | 13 | if (std::chrono::duration_cast(now - start).count() >= 1.0) { 14 | break; 15 | } 16 | 17 | counter++; 18 | } 19 | 20 | std::cout << counter << std::endl; 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TARGET = github.com/mrsobakin/itmournament/cmd/server 2 | OUT = itmournament 3 | 4 | all: build test 5 | 6 | internal/docker/.cache/buildctx.tar: internal/docker/Dockerfile 7 | mkdir -p internal/docker/.cache/ 8 | tar cf $@ -C internal/docker Dockerfile 9 | 10 | .PHONY: build 11 | build: internal/docker/.cache/buildctx.tar 12 | mkdir -p bin/ 13 | go build -o bin/$(OUT) $(TARGET) 14 | 15 | .PHONY: run 16 | run: 17 | go run $(TARGET) $(ARGS) 18 | 19 | .PHONY: fmt 20 | fmt: 21 | go fmt ./... 22 | 23 | .PHONY: test 24 | test: 25 | go test ./... -test.v 26 | 27 | .PHONY: coverage 28 | coverage: 29 | mkdir -p .cache 30 | go test -cover -coverprofile .cache/cover.out ./... 31 | 32 | .PHONY: coverage-html 33 | coverage-html: coverage 34 | go tool cover -html=.cache/cover.out 35 | 36 | .PHONY: clean 37 | clean: 38 | -rm -rf bin/ 39 | -find -type d -name '.cache' -exec rm -r {} + 40 | -------------------------------------------------------------------------------- /cmd/server/utils.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/gin-gonic/gin" 7 | 8 | "github.com/mrsobakin/itmournament/internal/docker" 9 | "github.com/mrsobakin/itmournament/internal/game" 10 | ) 11 | 12 | func tryBindParams(ctx *gin.Context, obj any) (ok bool) { 13 | if err := ctx.BindJSON(&obj); err != nil { 14 | ctx.JSON(422, map[string]any{ 15 | "error": ErrBadFormat, 16 | "details": err.Error(), 17 | }) 18 | return false 19 | } 20 | return true 21 | } 22 | 23 | type dockerFactory struct { 24 | runner *docker.SubmissionRunner 25 | imageId string 26 | } 27 | 28 | func NewDockerFactory(runner *docker.SubmissionRunner, imageId string) *dockerFactory { 29 | return &dockerFactory{ 30 | runner, 31 | imageId, 32 | } 33 | } 34 | 35 | func (d *dockerFactory) NewPlayer(ctx context.Context) game.Player { 36 | p, err := docker.NewDockerPlayer(d.runner, ctx, d.imageId) 37 | if err != nil { 38 | panic(err) 39 | } 40 | 41 | return p 42 | } 43 | -------------------------------------------------------------------------------- /internal/game/player_ext.go: -------------------------------------------------------------------------------- 1 | package game 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/mrsobakin/itmournament/internal/game/field" 7 | ) 8 | 9 | type PlayerExt struct { 10 | Player 11 | } 12 | 13 | func (p *PlayerExt) Sendf(format string, a ...any) (string, error) { 14 | return p.SendCommand(fmt.Sprintf(format, a...)) 15 | } 16 | 17 | func (p *PlayerExt) SendScanf(cmd string, format string, a ...any) error { 18 | resp, err := p.SendCommand(cmd) 19 | if err != nil { 20 | return err 21 | } 22 | 23 | n, err := fmt.Sscanf(resp, format, a...) 24 | if err != nil { 25 | return err 26 | } 27 | if n != len(a) { 28 | return fmt.Errorf("response does not match format") 29 | } 30 | 31 | return nil 32 | } 33 | 34 | func (p *PlayerExt) RequestAndGetField(conf field.Configuration) (field.Field, error) { 35 | resp, err := p.SendCommand("dump /tmp/field.txt") 36 | if err != nil { 37 | return nil, err 38 | } 39 | if resp != "ok" { 40 | return nil, fmt.Errorf("did not dump field") 41 | } 42 | 43 | return p.RetrieveField(conf) 44 | } 45 | -------------------------------------------------------------------------------- /internal/docker/testdata/game/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | template 6 | void SimulateWork(D duration, size_t memory) { 7 | std::this_thread::sleep_for(duration); 8 | 9 | char* arr = new char[memory]; 10 | for (size_t i = 0; i < memory; ++i) { 11 | arr[i] = 1; 12 | } 13 | }; 14 | 15 | int main() { 16 | using namespace std::chrono_literals; 17 | 18 | for (int i = 1; i <= 5; ++i) { 19 | std::string cmd, args; 20 | std::cin >> cmd >> args; 21 | 22 | if (cmd == "echo") { 23 | SimulateWork(400ms, 32 * 1024 * 1024); 24 | 25 | // stoi used specifically because it throws 26 | std::cout << std::stoi(args) << std::endl; 27 | } else if (cmd == "field") { 28 | SimulateWork(2s, 100 * 1024 * 1024); 29 | 30 | std::ofstream f(args); 31 | f << 32 | "10 10\n" 33 | "1 h 0 0\n" 34 | "2 h 0 2\n" 35 | "3 h 0 4\n" 36 | "4 h 0 6\n"; 37 | f.close(); 38 | 39 | std::cout << "ok" << std::endl; 40 | 41 | SimulateWork(500ms, 300 * 1024 * 1024); 42 | } 43 | } 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /scripts/build.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import csv 3 | import json 4 | 5 | import httpx 6 | from tqdm import tqdm 7 | 8 | 9 | ENDPOINT = "http://localhost:4239/build" 10 | 11 | 12 | async def send_request(client: httpx.AsyncClient, bar: tqdm, semaphore: asyncio.Semaphore, repo: str, ref: str) -> dict: 13 | async with semaphore: 14 | response = await client.post(ENDPOINT, json={ 15 | "repo": repo, 16 | "ref": ref 17 | }) 18 | 19 | data = { 20 | **response.json(), 21 | "repo": repo, 22 | "ref": ref, 23 | } 24 | 25 | bar.update() 26 | 27 | return data 28 | 29 | 30 | async def main(csv_file: str) -> None: 31 | semaphore = asyncio.Semaphore(4) 32 | async with httpx.AsyncClient(timeout=180) as client: 33 | bar = tqdm("Build repos") 34 | tasks = [] 35 | with open(csv_file, 'r') as file: 36 | reader = csv.DictReader(file) 37 | for row in reader: 38 | repo = row['repo'] 39 | ref = row['ref'] 40 | tasks.append(send_request(client, bar, semaphore, repo, ref)) 41 | 42 | bar.total = len(tasks) 43 | results = await asyncio.gather(*tasks) 44 | 45 | with open("build_logs.json", "w") as f: 46 | json.dump(results, f) 47 | 48 | 49 | if __name__ == "__main__": 50 | csv_file_path = "repos.csv" 51 | asyncio.run(main(csv_file_path)) 52 | -------------------------------------------------------------------------------- /cmd/server/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "os" 7 | "runtime" 8 | 9 | "golang.org/x/sync/semaphore" 10 | 11 | "github.com/docker/docker/client" 12 | "github.com/gin-gonic/gin" 13 | "github.com/mrsobakin/itmournament/internal/docker" 14 | ) 15 | 16 | func InitDockerThings(limits docker.Limits) (*docker.SubmissionBuilder, *docker.SubmissionRunner, error) { 17 | ctx := context.Background() 18 | 19 | var err error 20 | cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) 21 | 22 | if err != nil { 23 | return nil, nil, err 24 | } 25 | 26 | token, ok := os.LookupEnv("GIT_AUTH_TOKEN") 27 | 28 | if !ok { 29 | return nil, nil, fmt.Errorf("GIT_AUTH_TOKEN is not set") 30 | } 31 | 32 | builder, err := docker.NewSubmissionBuilder(cli, ctx, token) 33 | runner := docker.NewSubmissionRunner(cli, limits) 34 | 35 | return builder, runner, err 36 | } 37 | 38 | func NewServer() *server { 39 | limits := docker.Limits{ 40 | Memory: 70 * 1024 * 1024, 41 | VCPUs: 1, 42 | } 43 | 44 | builder, runner, err := InitDockerThings(limits) 45 | if err != nil { 46 | panic(err) 47 | } 48 | 49 | nCPU := runtime.NumCPU() * 2 50 | 51 | return &server{ 52 | builder: builder, 53 | runner: runner, 54 | jobs: semaphore.NewWeighted(int64(nCPU)), 55 | } 56 | } 57 | 58 | func main() { 59 | router := gin.Default() 60 | 61 | s := NewServer() 62 | 63 | s.RegisterEndpoints(router) 64 | 65 | addr := "127.0.0.1:4239" 66 | if len(os.Args) >= 2 { 67 | addr = os.Args[1] 68 | } 69 | 70 | fmt.Println(router.Run(addr)) 71 | } 72 | -------------------------------------------------------------------------------- /internal/judge/mock.go: -------------------------------------------------------------------------------- 1 | package judge 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/mrsobakin/itmournament/internal/game/field" 8 | ) 9 | 10 | type mockPlayer struct { 11 | conf field.Configuration 12 | field field.Field 13 | 14 | x, y int64 15 | } 16 | 17 | func newMockMaster(field field.Field, conf field.Configuration) *mockPlayer { 18 | return &mockPlayer{ 19 | conf: conf, 20 | field: field, 21 | x: 0, 22 | y: 0, 23 | } 24 | 25 | } 26 | 27 | func (p *mockPlayer) SendCommand(cmd string) (string, error) { 28 | switch cmd { 29 | case "get count 1": 30 | return fmt.Sprint(p.conf.Sizes[0]), nil 31 | case "get count 2": 32 | return fmt.Sprint(p.conf.Sizes[1]), nil 33 | case "get count 3": 34 | return fmt.Sprint(p.conf.Sizes[2]), nil 35 | case "get count 4": 36 | return fmt.Sprint(p.conf.Sizes[3]), nil 37 | case "get width": 38 | return fmt.Sprint(p.conf.W), nil 39 | case "get height": 40 | return fmt.Sprint(p.conf.H), nil 41 | case "win": 42 | return "no", nil 43 | case "shot": 44 | return fmt.Sprintf("%d %d", p.x, p.y), nil 45 | } 46 | 47 | if strings.HasPrefix(cmd, "shot ") { 48 | var x, y int64 49 | fmt.Sscanf(cmd, "shot %d %d", &x, &y) 50 | 51 | result := p.field.Shoot(x, y) 52 | return result.String(), nil 53 | } 54 | 55 | switch cmd { 56 | case "set result miss": 57 | // Good. We found an empty cell. 58 | case "set result hit", "Set result kill": 59 | p.x += 1 60 | 61 | if p.x == p.conf.W { 62 | p.x = 0 63 | p.y += 1 64 | } 65 | 66 | if p.y == p.conf.H { 67 | p.y = 0 68 | } 69 | } 70 | 71 | return "ok", nil 72 | } 73 | 74 | func (p *mockPlayer) RetrieveField(field.Configuration) (field.Field, error) { 75 | return p.field, nil 76 | } 77 | 78 | func (p *mockPlayer) Close() error { 79 | return nil 80 | } 81 | -------------------------------------------------------------------------------- /internal/docker/player.go: -------------------------------------------------------------------------------- 1 | package docker 2 | 3 | import ( 4 | "bufio" 5 | "context" 6 | "errors" 7 | 8 | "github.com/mrsobakin/itmournament/internal/game" 9 | "github.com/mrsobakin/itmournament/internal/game/field" 10 | ) 11 | 12 | func convertContainerErrToPlayerErr(err error) error { 13 | var contErr = &ErrorTerminated{} 14 | if !errors.As(err, &contErr) { 15 | return err 16 | } 17 | 18 | result := contErr.Result 19 | 20 | if result.Err != nil { 21 | return result.Err 22 | } 23 | 24 | var reason game.TerminationReason 25 | switch result.ExitCode { 26 | case 0: 27 | reason = game.ReasonNormal 28 | case 137: 29 | reason = game.ReasonMemoryLimit 30 | default: 31 | reason = game.ReasonRuntimeError 32 | } 33 | 34 | return &game.ErrorTerminated{Reason: reason} 35 | } 36 | 37 | type DockerPlayer struct { 38 | cont *SubmissionContainer 39 | scanner *bufio.Scanner 40 | } 41 | 42 | func NewDockerPlayer(runner *SubmissionRunner, ctx context.Context, imageId string) (*DockerPlayer, error) { 43 | cont, err := runner.CreateSubmissionContainer(ctx, imageId) 44 | if err != nil { 45 | return nil, err 46 | } 47 | cont.Start() 48 | 49 | scanner := bufio.NewScanner(cont.Stdout) 50 | scanner.Split(bufio.ScanLines) 51 | 52 | p := &DockerPlayer{ 53 | cont, 54 | scanner, 55 | } 56 | 57 | return p, nil 58 | } 59 | 60 | func (p *DockerPlayer) SendCommand(cmd string) (string, error) { 61 | cmd += "\n" 62 | 63 | _, err := p.cont.Stdin.Write([]byte(cmd)) 64 | if err != nil { 65 | return "", err 66 | } 67 | 68 | if !p.scanner.Scan() { 69 | return "", convertContainerErrToPlayerErr(p.scanner.Err()) 70 | } 71 | 72 | return p.scanner.Text(), nil 73 | } 74 | 75 | func (p *DockerPlayer) RetrieveField(conf field.Configuration) (field.Field, error) { 76 | r, err := p.cont.ReadFile("/tmp/field.txt") 77 | 78 | if err != nil { 79 | return nil, convertContainerErrToPlayerErr(err) 80 | } 81 | 82 | f := field.NewShipField(0) 83 | 84 | ships := field.ParseShips(r) 85 | err = f.Load(conf, ships) 86 | if err != nil { 87 | return nil, err 88 | } 89 | 90 | return f, nil 91 | } 92 | 93 | func (p *DockerPlayer) Close() error { 94 | return p.cont.Close() 95 | } 96 | -------------------------------------------------------------------------------- /internal/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:12-slim AS builder 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | RUN apt-get update && apt-get install -y cmake g++ git 5 | 6 | # If source if explicitly set, use it. Else, build a github git url. 7 | ARG repo ref src 8 | ADD --keep-git-dir ${src:-https://github.com/$repo.git#$ref} "/var/tournament/repo/" 9 | 10 | RUN --network=none < /' 16 | echo 17 | } 18 | 19 | cd "$REPO" 20 | 21 | # Support importing code from archives. 22 | case $src in 23 | http://*.tar | https://*.tar) 24 | tar xf *.tar 25 | esac 26 | 27 | echo 'Applying fixes...' 28 | find . -type f -name 'CMakeLists.txt' -exec sed -i ' 29 | s/^cmake_minimum_required(.*$/cmake_minimum_required(VERSION 3.12)/ 30 | /^set(CMAKE_CXX_COMPILER/d 31 | /^set(CMAKE_C_COMPILER/d 32 | /^FetchContent_Declare(/{s/^/return()\n/} 33 | ' {} +; 34 | 35 | if [ -d .git ]; then 36 | if ! git diff --exit-code > /dev/null ; then 37 | echo Below is the diff for the applied fixes. 38 | echo If they break your build, prepend spaces before the changed lines and apply fixes manually. 39 | git diff | indent 40 | else 41 | echo No fixes were applied. Nice. 42 | echo 43 | fi 44 | 45 | rm -rf .git 46 | fi 47 | 48 | BUILDDIR=$(mktemp -d --suffix=.build) 49 | 50 | echo Generating the buildsystem... 51 | cmake "$REPO" -B "$BUILDDIR" 2>&1 | indent 52 | 53 | echo Building the submission... 54 | cmake --build "$BUILDDIR" 2>&1 | indent 55 | 56 | echo Searching for the executable... 57 | MAIN_EXECUTABLE=$(find "$BUILDDIR" -type d -name 'CMakeFiles' -prune -o -type f -executable -print | head -n1) 58 | 59 | if [ -z "$MAIN_EXECUTABLE" ]; then 60 | echo No executable files found. Make sure that your build produces EXACTLY ONE executable file. 61 | exit 1 62 | fi 63 | 64 | echo Assuming that \""$MAIN_EXECUTABLE"\" is the main executable file. 65 | echo If that is not the case, make sure that your build produces EXACTLY ONE executable file. 66 | 67 | echo Exporting executable file... 68 | cp "$MAIN_EXECUTABLE" "$ARTIFACT" 69 | EOF 70 | 71 | FROM debian:12-slim 72 | 73 | COPY --from=builder --chmod=755 /var/tournament/artifact.out /opt/tournament-submission 74 | 75 | CMD ["/opt/tournament-submission"] 76 | -------------------------------------------------------------------------------- /scripts/get_repos.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import os 3 | import time 4 | 5 | import requests 6 | from tqdm import tqdm 7 | 8 | GITHUB_TOKEN = os.environ.get("GIT_AUTH_TOKEN") 9 | ORGANIZATION = "is-itmo-c-24" 10 | 11 | GITHUB_API_URL = "https://api.github.com" 12 | HEADERS = { 13 | "Authorization": f"Bearer {GITHUB_TOKEN}", 14 | "Accept": "application/vnd.github+json" 15 | } 16 | 17 | 18 | def make_github_request(endpoint, params=None): 19 | url = f"{GITHUB_API_URL}/{endpoint.lstrip('/')}" 20 | while True: 21 | response = requests.get(url, headers=HEADERS, params=params) 22 | if response.status_code == 403: 23 | remaining = int(response.headers.get("X-RateLimit-Remaining", 1)) 24 | if remaining == 0: 25 | reset_time = int(response.headers.get("X-RateLimit-Reset", time.time())) 26 | sleep_time = reset_time - int(time.time()) 27 | time.sleep(max(sleep_time, 0)) 28 | continue 29 | return response 30 | 31 | 32 | def get_repositories(org): 33 | repositories = [] 34 | page = 1 35 | 36 | bar = tqdm(desc="Getting all repositories") 37 | while True: 38 | bar.update() 39 | response = make_github_request(f"/orgs/{org}/repos", params={"per_page": 100, "page": page}) 40 | data = response.json() 41 | if not data: 42 | break 43 | repositories.extend(data) 44 | page += 1 45 | bar.close() 46 | 47 | return repositories 48 | 49 | 50 | def get_branch_ref(repo_name, branch_name): 51 | response = make_github_request(f"/repos/{ORGANIZATION}/{repo_name}/branches/{branch_name}") 52 | branch_data = response.json() 53 | 54 | if response.status_code == 404: 55 | return None 56 | 57 | return branch_data.get("commit", {}).get("sha") 58 | 59 | 60 | def main(): 61 | repositories = get_repositories(ORGANIZATION) 62 | 63 | repositories = list(filter(lambda r: r["name"].startswith("labwork5-"), repositories)) 64 | 65 | repos_with_branch = [] 66 | for repo in tqdm(repositories, desc="Filtering repositories"): 67 | repo_name = repo["name"] 68 | 69 | branch_ref = get_branch_ref(repo_name, "tournament") 70 | if branch_ref: 71 | repos_with_branch.append({"repo": f"{ORGANIZATION}/{repo_name}", "ref": branch_ref}) 72 | 73 | with open("repos.csv", mode="w", newline="", encoding="utf-8") as file: 74 | writer = csv.DictWriter(file, fieldnames=["repo", "ref"]) 75 | writer.writeheader() 76 | writer.writerows(repos_with_branch) 77 | 78 | 79 | if __name__ == "__main__": 80 | main() 81 | -------------------------------------------------------------------------------- /internal/game/field/field.go: -------------------------------------------------------------------------------- 1 | package field 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "io" 7 | "iter" 8 | ) 9 | 10 | type ShootResult int 11 | 12 | const ( 13 | Miss ShootResult = iota 14 | Hit 15 | Kill 16 | ) 17 | 18 | func (r *ShootResult) FromString(str string) error { 19 | switch str { 20 | case "miss": 21 | *r = Miss 22 | case "hit": 23 | *r = Hit 24 | case "kill": 25 | *r = Kill 26 | default: 27 | return fmt.Errorf("invalid shoot result") 28 | } 29 | return nil 30 | } 31 | 32 | func (r ShootResult) String() string { 33 | switch r { 34 | case Miss: 35 | return "miss" 36 | case Hit: 37 | return "hit" 38 | case Kill: 39 | return "kill" 40 | default: 41 | panic("invalid shoot result") 42 | } 43 | } 44 | 45 | type Configuration struct { 46 | W, H int64 47 | Sizes [4]int64 48 | } 49 | 50 | func (c *Configuration) IsValid() error { 51 | if c.W <= 0 || c.H <= 0 { 52 | return fmt.Errorf("non-positive field size: [%d %d]", c.W, c.H) 53 | } 54 | 55 | if c.Sizes[0] < 0 || c.Sizes[1] < 0 || c.Sizes[2] < 0 || c.Sizes[3] < 0 { 56 | return fmt.Errorf("negative ship amount: [%d %d %d %d]", c.Sizes[0], c.Sizes[1], c.Sizes[2], c.Sizes[3]) 57 | } 58 | 59 | if (c.Sizes[0] + c.Sizes[1] + c.Sizes[2] + c.Sizes[3]) <= 0 { 60 | return fmt.Errorf("summary ship count is non-positive: [%d %d %d %d]", c.Sizes[0], c.Sizes[1], c.Sizes[2], c.Sizes[3]) 61 | } 62 | 63 | return nil 64 | } 65 | 66 | type Ship struct { 67 | X, Y int64 68 | Size int8 69 | IsVert bool 70 | } 71 | 72 | type Field interface { 73 | // Loads field given ship sequence and configuration. 74 | // 75 | // If field is invalid, i.e. has ships intersecting, 76 | // exceeds field size or ship conunt does not match 77 | // given configuration, returns an error. 78 | Load(Configuration, iter.Seq[Ship]) error 79 | 80 | // Emulates a shot, modifies field internal state and 81 | // returns the expected result of a shot. 82 | Shoot(x, y int64) ShootResult 83 | 84 | // Undoes all shots on the field, i.e. reverts field 85 | // to the state just after `Load`. 86 | ResetShots() 87 | 88 | // Returns whether all ships are destroyed, i.e. the 89 | // corresponding player lost. 90 | AllDead() bool 91 | } 92 | 93 | func ParseShips(src io.Reader) iter.Seq[Ship] { 94 | return func(yield func(s Ship) bool) { 95 | lines := bufio.NewScanner(src) 96 | 97 | // Skip first line with field dimensions 98 | lines.Scan() 99 | 100 | for lines.Scan() { 101 | var ship Ship 102 | var direction rune 103 | 104 | n, err := fmt.Sscanf(lines.Text(), "%d %c %d %d", &ship.Size, &direction, &ship.X, &ship.Y) 105 | 106 | if err != nil || n != 4 { 107 | return 108 | } 109 | 110 | switch direction { 111 | case 'v': 112 | ship.IsVert = true 113 | case 'h': 114 | ship.IsVert = false 115 | default: 116 | return 117 | } 118 | 119 | if !yield(ship) { 120 | return 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /scripts/run_submissions.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import json 3 | import os 4 | from random import shuffle 5 | import httpx 6 | from tqdm import tqdm 7 | from itertools import permutations 8 | 9 | ENDPOINT = "http://localhost:4239/run_match" 10 | 11 | 12 | async def send_request(client: httpx.AsyncClient, lock: asyncio.Lock, semaphore: asyncio.Semaphore, bar: tqdm, master_image_id: str, slave_image_id: str) -> None: 13 | async with semaphore: 14 | # try: 15 | response = await client.post(ENDPOINT, json={ 16 | "master_image_id": master_image_id, 17 | "slave_image_id": slave_image_id 18 | }) 19 | 20 | data = { 21 | **response.json(), 22 | "master_image_id": master_image_id, 23 | "slave_image_id": slave_image_id, 24 | } 25 | 26 | async with lock: 27 | with open("match_results.json", "a") as f: 28 | f.write(json.dumps(data) + "\n") 29 | 30 | bar.update() 31 | 32 | # except Exception as e: 33 | # print(f"Error with master={master_image_id}, slave={slave_image_id}: {e}") 34 | 35 | 36 | def load_existing_results(results_file: str) -> set: 37 | if not os.path.exists(results_file): 38 | return set() 39 | 40 | completed_pairs = set() 41 | with open(results_file, "r") as f: 42 | for line in f: 43 | try: 44 | result = json.loads(line) 45 | completed_pairs.add((result["master_image_id"], result["slave_image_id"])) 46 | except json.JSONDecodeError: 47 | pass 48 | 49 | return completed_pairs 50 | 51 | 52 | def load_pending_pairs(build_logs_file: str, results_file: str) -> list: 53 | with open(build_logs_file, 'r') as f: 54 | build_logs = json.load(f) 55 | 56 | image_ids = [entry['image_id'] for entry in build_logs if 'image_id' in entry] 57 | all_pairs = list(permutations(image_ids, 2)) 58 | 59 | completed_pairs = load_existing_results(results_file) 60 | pending_pairs = [pair for pair in all_pairs if pair not in completed_pairs] 61 | 62 | shuffle(pending_pairs) 63 | 64 | return pending_pairs 65 | 66 | 67 | async def run_matches(pending_pairs: list) -> None: 68 | lock = asyncio.Lock() 69 | semaphore = asyncio.Semaphore(75) 70 | bar = tqdm(total=len(pending_pairs), desc="Running match submissions") 71 | 72 | async with httpx.AsyncClient(timeout=100000) as client: 73 | tasks = [ 74 | send_request(client, lock, semaphore, bar, master, slave) 75 | for master, slave in pending_pairs 76 | ] 77 | 78 | await asyncio.gather(*tasks) 79 | 80 | 81 | if __name__ == "__main__": 82 | build_logs_file_path = "build_logs.json" 83 | results_file_path = "match_results.json" 84 | 85 | if not os.path.exists(results_file_path): 86 | with open(results_file_path, "w") as f: 87 | pass 88 | 89 | pending_pairs = load_pending_pairs(build_logs_file_path, results_file_path) 90 | asyncio.run(run_matches(pending_pairs)) 91 | 92 | -------------------------------------------------------------------------------- /cmd/server/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | "strings" 7 | "time" 8 | 9 | "github.com/gin-gonic/gin" 10 | "golang.org/x/sync/semaphore" 11 | 12 | "github.com/mrsobakin/itmournament/internal/docker" 13 | "github.com/mrsobakin/itmournament/internal/judge" 14 | ) 15 | 16 | const ( 17 | BuildTimeout time.Duration = 100 * time.Minute 18 | PlayerTimeout time.Duration = 2 * time.Minute 19 | GlobalTimeout time.Duration = 7 * time.Minute 20 | ) 21 | 22 | const ( 23 | ErrBadRepo string = "bad_repo" 24 | ErrBadFormat string = "bad_format" 25 | ErrUnknown string = "unknown" 26 | ErrTimeout string = "timeout" 27 | ) 28 | 29 | var ( 30 | errBuildTimeout error = errors.New("build timeout") 31 | ) 32 | 33 | type server struct { 34 | builder *docker.SubmissionBuilder 35 | runner *docker.SubmissionRunner 36 | jobs *semaphore.Weighted 37 | } 38 | 39 | func (s *server) handleBuild(c *gin.Context) { 40 | var params struct { 41 | Repo string `json:"repo" binding:"required"` 42 | Ref string `json:"ref" binding:"required"` 43 | } 44 | 45 | if !tryBindParams(c, ¶ms) { 46 | return 47 | } 48 | 49 | s.jobs.Acquire(c, 1) 50 | defer s.jobs.Release(1) 51 | 52 | timeoutCtx, cancel := context.WithTimeoutCause(context.Background(), BuildTimeout, errBuildTimeout) 53 | defer cancel() 54 | 55 | result := s.builder.Build(timeoutCtx, docker.Source{ 56 | Repo: params.Repo, 57 | Ref: params.Ref, 58 | }) 59 | 60 | if result.Err == nil { 61 | c.JSON(200, map[string]any{ 62 | "image_id": result.ImageId, 63 | "logs": result.Logs, 64 | }) 65 | return 66 | } 67 | 68 | var err string 69 | var errCode int 70 | 71 | if strings.HasPrefix(result.Err.Error(), "failed to solve: failed to load cache key: error fetching default branch for repository https://github.com/.git:") { 72 | errCode = 400 73 | err = ErrBadRepo 74 | } else if errors.Is(result.Err, errBuildTimeout) { 75 | errCode = 408 76 | err = ErrTimeout 77 | } else { 78 | errCode = 400 79 | err = ErrUnknown 80 | } 81 | 82 | c.JSON(errCode, map[string]any{ 83 | "error": err, 84 | "details": result.Err.Error(), 85 | "logs": result.Logs, 86 | }) 87 | } 88 | 89 | func (s *server) handleMatch(c *gin.Context) { 90 | var params struct { 91 | MasterImageId string `json:"master_image_id" binding:"required"` 92 | SlaveImageId string `json:"slave_image_id" binding:"required"` 93 | } 94 | 95 | if !tryBindParams(c, ¶ms) { 96 | return 97 | } 98 | 99 | s.jobs.Acquire(c, 2) 100 | defer s.jobs.Release(2) 101 | 102 | j := judge.Judge{ 103 | PlayerTimeout: PlayerTimeout, 104 | GlobalTimeout: GlobalTimeout, 105 | } 106 | 107 | verdict := j.Judge( 108 | c.Request.Context(), 109 | NewDockerFactory(s.runner, params.MasterImageId), 110 | NewDockerFactory(s.runner, params.SlaveImageId), 111 | ) 112 | 113 | c.JSON(200, verdict) 114 | } 115 | 116 | func (s *server) RegisterEndpoints(e *gin.Engine) { 117 | e.POST("/build", s.handleBuild) 118 | e.POST("/run_match", s.handleMatch) 119 | } 120 | -------------------------------------------------------------------------------- /internal/utils/stopwatch.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "context" 5 | "sync/atomic" 6 | "time" 7 | ) 8 | 9 | // Keeps track of the time that passes between `Stopwatch.Resume()` 10 | // and `Stopwatch.Pause()` calls. 11 | // 12 | // If at some point while the stopwatch is running, it's summary running 13 | // time exceedes the given timeout, provided `cancelFunc` is called. 14 | // 15 | // To avoid having dangling goroutines, `Stopwatch.Close()` should be 16 | // called when the stopwatch is no longer needed. 17 | // 18 | // Stopwatch is not thread safe. 19 | type Stopwatch struct { 20 | totalPassed time.Duration 21 | timeout time.Duration 22 | lastResume time.Time 23 | deadlineUpdates chan<- *time.Duration 24 | closed atomic.Bool 25 | } 26 | 27 | // Creates Stopwatch with given timeout and cancelFunc. 28 | // 29 | // Created Stopwatch is in PAUSED state. 30 | func NewStopwatch(timeout time.Duration, cancelFunc func()) *Stopwatch { 31 | deadlineUpdates := make(chan *time.Duration) 32 | 33 | s := Stopwatch{ 34 | totalPassed: 0, 35 | timeout: timeout, 36 | lastResume: time.Time{}, 37 | deadlineUpdates: deadlineUpdates, 38 | closed: atomic.Bool{}, 39 | } 40 | 41 | go func(deadlineUpdates <-chan *time.Duration) { 42 | var timeLeft *time.Duration = nil 43 | 44 | for { 45 | if timeLeft != nil { 46 | select { 47 | case <-time.After(*timeLeft): 48 | { 49 | s.Close() 50 | cancelFunc() 51 | return 52 | } 53 | case newTimeLeft, ok := <-deadlineUpdates: 54 | { 55 | if !ok { 56 | return 57 | } 58 | timeLeft = newTimeLeft 59 | } 60 | } 61 | } else { 62 | newTimeLeft, ok := <-deadlineUpdates 63 | if !ok { 64 | return 65 | } 66 | timeLeft = newTimeLeft 67 | } 68 | } 69 | }(deadlineUpdates) 70 | 71 | return &s 72 | } 73 | 74 | func (s *Stopwatch) Resume() { 75 | s.lastResume = time.Now() 76 | 77 | untilDeadline := s.timeout - s.totalPassed 78 | if !s.closed.Load() { 79 | s.deadlineUpdates <- &untilDeadline 80 | } 81 | } 82 | 83 | func (s *Stopwatch) Pause() { 84 | addDuration := time.Since(s.lastResume) 85 | if !s.closed.Load() { 86 | // TODO: race here: message is not yet sended, but the channel has just closed. 87 | s.deadlineUpdates <- nil 88 | } 89 | s.totalPassed += addDuration 90 | } 91 | 92 | func (s *Stopwatch) Close() { 93 | if !s.closed.Swap(true) { 94 | close(s.deadlineUpdates) 95 | } 96 | } 97 | 98 | // Creates context and stopwatch bounded together. 99 | // 100 | // When stopwatch summary exceedes `timeout`, context is cancelled 101 | // with `cause` cause. 102 | // 103 | // When the parent context is cancelled, stopwatch is closed. 104 | func NewStopwatchContext(parent context.Context, timeout time.Duration, cause error) (context.Context, *Stopwatch) { 105 | ctx, cancel := context.WithCancelCause(parent) 106 | sw := NewStopwatch(timeout, func() { 107 | cancel(cause) 108 | }) 109 | 110 | go func() { 111 | select { 112 | case <-parent.Done(): 113 | case <-ctx.Done(): 114 | } 115 | sw.Close() 116 | }() 117 | 118 | return ctx, sw 119 | } 120 | -------------------------------------------------------------------------------- /internal/docker/utils.go: -------------------------------------------------------------------------------- 1 | package docker 2 | 3 | import ( 4 | "archive/tar" 5 | "bufio" 6 | "context" 7 | "encoding/binary" 8 | "errors" 9 | "io" 10 | 11 | "github.com/moby/buildkit/client" 12 | "github.com/moby/buildkit/session/secrets" 13 | "github.com/opencontainers/go-digest" 14 | ) 15 | 16 | type Limits struct { 17 | // Memory in bytes 18 | Memory int64 19 | VCPUs float64 20 | } 21 | 22 | type dockerStdoutReader struct { 23 | left uint32 24 | muxed *bufio.Reader 25 | } 26 | 27 | func newDockerStdoutReader(r *bufio.Reader) *dockerStdoutReader { 28 | return &dockerStdoutReader{ 29 | left: 0, 30 | muxed: r, 31 | } 32 | } 33 | 34 | func (r *dockerStdoutReader) Read(p []byte) (int, error) { 35 | if r.left == 0 { 36 | header := make([]byte, 8) 37 | 38 | n, err := r.muxed.Read(header) 39 | 40 | if err != nil { 41 | return n, err 42 | } 43 | 44 | if n != 8 { 45 | return 0, nil 46 | } 47 | 48 | // Skip non-stdout 49 | if header[0] != 1 { 50 | return 0, nil 51 | } 52 | 53 | r.left = binary.BigEndian.Uint32(header[4:]) 54 | } 55 | 56 | if r.left > uint32(cap(p)) { 57 | r.left -= uint32(cap(p)) 58 | } else { 59 | r.left = 0 60 | } 61 | 62 | return r.muxed.Read(p) 63 | } 64 | 65 | type gitAuthTokenProvider struct { 66 | token string 67 | } 68 | 69 | func (p *gitAuthTokenProvider) GetSecret(ctx context.Context, id string) ([]byte, error) { 70 | if id != "GIT_AUTH_TOKEN" { 71 | return nil, secrets.ErrNotFound 72 | } 73 | return []byte(p.token), nil 74 | } 75 | 76 | type untarReader struct { 77 | foundHeader bool 78 | close func() error 79 | tar *tar.Reader 80 | } 81 | 82 | func newUntarReader(r io.ReadCloser) *untarReader { 83 | return &untarReader{ 84 | foundHeader: false, 85 | close: r.Close, 86 | tar: tar.NewReader(r), 87 | } 88 | } 89 | 90 | func (r *untarReader) Close() error { 91 | return r.close() 92 | } 93 | 94 | func (r *untarReader) Read(buf []byte) (int, error) { 95 | if !r.foundHeader { 96 | r.tar.Next() 97 | r.foundHeader = true 98 | } 99 | 100 | return r.tar.Read(buf) 101 | } 102 | 103 | type readerWithContainerError struct { 104 | inner io.Reader 105 | cont *SubmissionContainer 106 | } 107 | 108 | func readerInjectContainerError(r io.Reader, cont *SubmissionContainer) io.Reader { 109 | return &readerWithContainerError{ 110 | inner: r, 111 | cont: cont, 112 | } 113 | } 114 | 115 | func (r *readerWithContainerError) Read(p []byte) (int, error) { 116 | n, err := r.inner.Read(p) 117 | 118 | if errors.Is(err, io.EOF) { 119 | result := r.cont.Wait() 120 | err = &ErrorTerminated{result} 121 | } 122 | 123 | return n, err 124 | } 125 | 126 | func updateLogsFromStep(ctx context.Context, w io.Writer, ch <-chan *client.SolveStatus, predicate func(*client.Vertex) bool) error { 127 | var keepFromVertex digest.Digest 128 | 129 | for { 130 | select { 131 | case s, ok := <-ch: 132 | if !ok { 133 | return nil 134 | } 135 | 136 | for _, v := range s.Vertexes { 137 | if predicate(v) { 138 | keepFromVertex = v.Digest 139 | } 140 | } 141 | 142 | for _, l := range s.Logs { 143 | if l.Vertex == keepFromVertex { 144 | if _, err := w.Write(l.Data); err != nil { 145 | return err 146 | } 147 | } 148 | } 149 | 150 | case <-ctx.Done(): 151 | return nil 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /scripts/post_issues.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import time 4 | 5 | import requests 6 | from tqdm import tqdm 7 | 8 | GITHUB_TOKEN = os.environ.get("GIT_AUTH_TOKEN") 9 | 10 | 11 | def post_or_comment_github_issue(repo, title, body, username="mrsobakin"): 12 | """ 13 | Creates a new GitHub issue or comments on an existing one by the user. 14 | 15 | Parameters: 16 | - repo: str - The target repository in the format "owner/repo". 17 | - title: str - Title of the issue to create or check. 18 | - body: str - Body of the new issue (if created). 19 | - username: str - Username of the issue creator to check for (default: "mrsobakin"). 20 | 21 | Returns: 22 | - dict: Response JSON from GitHub API. 23 | """ 24 | headers = { 25 | "Authorization": f"Bearer {GITHUB_TOKEN}", 26 | "Accept": "application/vnd.github+json", 27 | } 28 | 29 | # Step 1: Search for existing issues with the title 30 | search_url = f"https://api.github.com/repos/{repo}/issues" 31 | params = {"state": "open", "per_page": 100} # Adjust per_page if needed 32 | response = requests.get(search_url, headers=headers, params=params) 33 | 34 | if response.status_code != 200: 35 | raise Exception(f"Failed to fetch issues: {response.status_code}, {response.text}") 36 | 37 | issues = response.json() 38 | for issue in issues: 39 | if issue["title"] == title and issue["user"]["login"] == username: 40 | # Issue exists, post a comment 41 | comment_url = issue["comments_url"] 42 | comment_response = requests.post( 43 | comment_url, headers=headers, json={"body": body} 44 | ) 45 | if comment_response.status_code != 201: 46 | raise Exception(f"Failed to comment on issue: {comment_response.status_code}, {comment_response.text}") 47 | return {"action": "commented", "issue_url": issue["html_url"], "response": comment_response.json()} 48 | 49 | # Step 2: No matching issue found, create a new issue 50 | create_issue_url = f"https://api.github.com/repos/{repo}/issues" 51 | issue_data = {"title": title, "body": body} 52 | create_response = requests.post(create_issue_url, headers=headers, json=issue_data) 53 | 54 | if create_response.status_code != 201: 55 | raise Exception(f"Failed to create issue: {create_response.status_code}, {create_response.text}") 56 | return {"action": "created", "issue_url": create_response.json()["html_url"], "response": create_response.json()} 57 | 58 | 59 | if __name__ == "__main__": 60 | with open("build_logs.json") as f: 61 | data = json.load(f) 62 | 63 | for d in tqdm(data): 64 | user = d["repo"].split("/")[1].split("-", 1)[1] 65 | ref = d["ref"] 66 | logs = d["logs"] 67 | 68 | if "image_id" in d: 69 | msg = f"Hi again @{user}.\n\nThis is an update on build status of your submission. As of commit `{ref}`, it builds successfully. Good job 👍.\n\nThis is a last call to make any changes to your submission. Any changes made after `23:59:59 MSK` will be ignored.\n\nGood luck!" 70 | else: 71 | msg = f"Hi again @{user}.\n\nThis is an update on build status of your submission. As of commit `{ref}`, it fails to build. Simplified build log:\n\n```\n{logs}```\n\nThis is a last call to fix your submission or make any other changes to it. Any changes made after `23:59:59 MSK` will be ignored.\n\nGood luck!" 72 | 73 | post_or_comment_github_issue(d["repo"], "Battleship tournament", msg, "mrsobakin") 74 | time.sleep(7) 75 | -------------------------------------------------------------------------------- /internal/docker/builder.go: -------------------------------------------------------------------------------- 1 | package docker 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | _ "embed" 7 | "io" 8 | "strings" 9 | 10 | "github.com/docker/buildx/driver" 11 | _ "github.com/docker/buildx/driver/docker" 12 | dockerclient "github.com/docker/docker/client" 13 | "github.com/moby/buildkit/client" 14 | dockerfile "github.com/moby/buildkit/frontend/dockerfile/builder" 15 | "github.com/moby/buildkit/session" 16 | "github.com/moby/buildkit/session/secrets/secretsprovider" 17 | "github.com/moby/buildkit/session/upload/uploadprovider" 18 | 19 | // "github.com/moby/buildkit/util/progress/progressui" 20 | "golang.org/x/sync/errgroup" 21 | ) 22 | 23 | //go:embed .cache/buildctx.tar 24 | var buildCtxTarBytes []byte 25 | 26 | func getDockerBuildkitClient(ctx context.Context, client *dockerclient.Client) (*client.Client, error) { 27 | driverFactory, err := driver.GetFactory("docker", false) 28 | if err != nil { 29 | return nil, err 30 | } 31 | 32 | dockerHandle, err := driver.GetDriver(ctx, driverFactory, driver.InitConfig{ 33 | DockerAPI: client, 34 | }) 35 | 36 | if err != nil { 37 | return nil, err 38 | } 39 | 40 | return dockerHandle.Client(ctx) 41 | } 42 | 43 | type SubmissionBuilder struct { 44 | buildkitClient *client.Client 45 | tokenProvider *gitAuthTokenProvider 46 | } 47 | 48 | func NewSubmissionBuilder(cli *dockerclient.Client, ctx context.Context, token string) (*SubmissionBuilder, error) { 49 | buildkitClient, err := getDockerBuildkitClient(ctx, cli) 50 | if err != nil { 51 | return nil, err 52 | } 53 | 54 | return &SubmissionBuilder{ 55 | buildkitClient: buildkitClient, 56 | tokenProvider: &gitAuthTokenProvider{ 57 | token, 58 | }, 59 | }, nil 60 | } 61 | 62 | type BuildResult struct { 63 | ImageId string 64 | Logs string 65 | Err error 66 | } 67 | 68 | type Source struct { 69 | Repo string 70 | Ref string 71 | Src string 72 | } 73 | 74 | func (b *SubmissionBuilder) Build(ctx context.Context, src Source) BuildResult { 75 | up := uploadprovider.New() 76 | buildCtx := up.Add(io.NopCloser(bytes.NewReader(buildCtxTarBytes))) 77 | 78 | opts := client.SolveOpt{ 79 | Exports: []client.ExportEntry{ 80 | { 81 | Type: "moby", 82 | Attrs: map[string]string{ 83 | "name": "submission", 84 | }, 85 | }, 86 | }, 87 | Frontend: "dockerfile.v0", 88 | FrontendAttrs: map[string]string{ 89 | "context": buildCtx, 90 | "build-arg:repo": src.Repo, 91 | "build-arg:ref": src.Ref, 92 | "build-arg:src": src.Src, 93 | }, 94 | Session: []session.Attachable{ 95 | secretsprovider.NewSecretProvider(b.tokenProvider), 96 | up, 97 | }, 98 | } 99 | 100 | var result BuildResult 101 | var logBytes bytes.Buffer 102 | 103 | ch := make(chan *client.SolveStatus) 104 | eg, _ := errgroup.WithContext(ctx) 105 | 106 | eg.Go(func() error { 107 | resp, err := b.buildkitClient.Build(ctx, opts, "", dockerfile.Build, ch) 108 | if err == nil { 109 | imageId := resp.ExporterResponse["containerimage.digest"] 110 | result.ImageId = imageId 111 | } 112 | 113 | return err 114 | }) 115 | 116 | eg.Go(func() error { 117 | return updateLogsFromStep(ctx, &logBytes, ch, func(v *client.Vertex) bool { 118 | // TODO: it seems like there is no way to change vertex name 119 | // in docker file. So, kludges it is. 120 | return strings.HasPrefix(v.Name, "[builder 4/4] RUN --network=none ") 121 | }) 122 | }) 123 | 124 | result.Err = eg.Wait() 125 | result.Logs = logBytes.String() 126 | 127 | return result 128 | } 129 | -------------------------------------------------------------------------------- /internal/docker/player_test.go: -------------------------------------------------------------------------------- 1 | package docker_test 2 | 3 | import ( 4 | "context" 5 | "strconv" 6 | "testing" 7 | "time" 8 | 9 | "github.com/stretchr/testify/assert" 10 | "github.com/stretchr/testify/require" 11 | 12 | "github.com/mrsobakin/itmournament/internal/docker" 13 | "github.com/mrsobakin/itmournament/internal/game" 14 | "github.com/mrsobakin/itmournament/internal/game/field" 15 | ) 16 | 17 | func getPlayer(t testing.TB, memoryLimit int64) (game.Player, func()) { 18 | ctx, cancel := context.WithCancel(context.Background()) 19 | 20 | imageId := buildContainer(t, "game") 21 | 22 | runner := getRunner(t, docker.Limits{ 23 | Memory: memoryLimit, 24 | }) 25 | 26 | player, err := docker.NewDockerPlayer(runner, ctx, imageId) 27 | require.NoError(t, err) 28 | 29 | return player, cancel 30 | } 31 | 32 | func Test_MemoryLimit(t *testing.T) { 33 | player, cancel := getPlayer(t, 120*1024*1024) 34 | defer cancel() 35 | defer player.Close() 36 | 37 | for i := 1; i <= 3; i++ { 38 | str := strconv.Itoa(i) 39 | 40 | resp, err := player.SendCommand("echo " + str) 41 | assert.NoError(t, err) 42 | assert.Equal(t, str, resp) 43 | } 44 | 45 | _, err := player.SendCommand("echo 4") 46 | assert.ErrorIs(t, err, &game.ErrorTerminated{Reason: game.ReasonMemoryLimit}) 47 | } 48 | 49 | func Test_Exit(t *testing.T) { 50 | player, cancel := getPlayer(t, 500*1024*1024) 51 | defer cancel() 52 | defer player.Close() 53 | 54 | for i := 1; i <= 5; i++ { 55 | str := strconv.Itoa(i) 56 | 57 | resp, err := player.SendCommand("echo " + str) 58 | assert.NoError(t, err) 59 | assert.Equal(t, str, resp) 60 | } 61 | 62 | _, err := player.SendCommand("echo 6") 63 | assert.ErrorIs(t, err, &game.ErrorTerminated{Reason: game.ReasonNormal}) 64 | } 65 | 66 | func Test_RuntimeError(t *testing.T) { 67 | player, cancel := getPlayer(t, 500*1024*1024) 68 | defer cancel() 69 | defer player.Close() 70 | 71 | _, err := player.SendCommand("echo asd") 72 | assert.ErrorIs(t, err, &game.ErrorTerminated{Reason: game.ReasonRuntimeError}) 73 | } 74 | 75 | func Test_GetField(t *testing.T) { 76 | player, cancel := getPlayer(t, 500*1024*1024) 77 | defer cancel() 78 | defer player.Close() 79 | 80 | resp, err := player.SendCommand("field /tmp/field.txt") 81 | require.NoError(t, err) 82 | assert.Equal(t, "ok", resp) 83 | 84 | f, err := player.RetrieveField(field.Configuration{ 85 | W: 10, 86 | H: 10, 87 | Sizes: [4]int64{1, 1, 1, 1}, 88 | }) 89 | require.NoError(t, err) 90 | 91 | assert.Equal(t, field.Kill, f.Shoot(0, 0)) 92 | 93 | assert.Equal(t, field.Hit, f.Shoot(0, 2)) 94 | assert.Equal(t, field.Kill, f.Shoot(1, 2)) 95 | 96 | assert.Equal(t, field.Hit, f.Shoot(0, 4)) 97 | assert.Equal(t, field.Hit, f.Shoot(1, 4)) 98 | assert.Equal(t, field.Kill, f.Shoot(2, 4)) 99 | 100 | assert.Equal(t, field.Hit, f.Shoot(0, 6)) 101 | assert.Equal(t, field.Hit, f.Shoot(1, 6)) 102 | assert.Equal(t, field.Hit, f.Shoot(2, 6)) 103 | assert.Equal(t, field.Kill, f.Shoot(3, 6)) 104 | 105 | assert.True(t, f.AllDead()) 106 | } 107 | 108 | func Test_GetField_MemoryLimit(t *testing.T) { 109 | player, cancel := getPlayer(t, 150*1024*1024) 110 | defer cancel() 111 | defer player.Close() 112 | 113 | resp, err := player.SendCommand("field /tmp/field.txt") 114 | require.NoError(t, err) 115 | assert.Equal(t, "ok", resp) 116 | 117 | time.Sleep(time.Second) 118 | 119 | f, err := player.RetrieveField(field.Configuration{ 120 | W: 10, 121 | H: 10, 122 | Sizes: [4]int64{1, 1, 1, 1}, 123 | }) 124 | assert.ErrorIs(t, err, &game.ErrorTerminated{Reason: game.ReasonMemoryLimit}) 125 | assert.Nil(t, f) 126 | } 127 | -------------------------------------------------------------------------------- /internal/game/player.go: -------------------------------------------------------------------------------- 1 | package game 2 | 3 | import ( 4 | "context" 5 | "time" 6 | 7 | "github.com/mrsobakin/itmournament/internal/game/field" 8 | "github.com/mrsobakin/itmournament/internal/utils" 9 | ) 10 | 11 | type Role int 12 | 13 | const ( 14 | RoleMaster Role = iota 15 | RoleSlave 16 | ) 17 | 18 | func (r Role) Other() Role { 19 | if r == RoleMaster { 20 | return RoleSlave 21 | } else { 22 | return RoleMaster 23 | } 24 | } 25 | 26 | func (r Role) String() string { 27 | if r == RoleMaster { 28 | return "master" 29 | } else { 30 | return "slave" 31 | } 32 | } 33 | 34 | type TerminationReason int 35 | 36 | const ( 37 | ReasonNormal TerminationReason = iota 38 | ReasonRuntimeError 39 | ReasonMemoryLimit 40 | ReasonTimeLimit 41 | ) 42 | 43 | type ErrorTerminated struct { 44 | Reason TerminationReason 45 | } 46 | 47 | var ( 48 | ErrTerminatedMemoryLimit error = &ErrorTerminated{ReasonMemoryLimit} 49 | ) 50 | 51 | func (e *ErrorTerminated) Is(target error) bool { 52 | if err, ok := target.(*ErrorTerminated); ok { 53 | return e.Reason == err.Reason 54 | } 55 | 56 | return false 57 | } 58 | 59 | func (e *ErrorTerminated) Error() string { 60 | switch e.Reason { 61 | case ReasonNormal: 62 | return "player terminated normally" 63 | case ReasonRuntimeError: 64 | return "player terminated due to runtime error" 65 | case ReasonMemoryLimit: 66 | return "player terminated due to memory limit" 67 | case ReasonTimeLimit: 68 | return "player terminated due to time limit" 69 | default: 70 | panic("unknown termination reason") 71 | } 72 | } 73 | 74 | type Player interface { 75 | // Sends a command and receives a response for it. 76 | // 77 | // If Player was terminated, special error `ErrorTerminated` 78 | // will be returned. 79 | SendCommand(string) (string, error) 80 | 81 | // Retrieves player's field. 82 | // 83 | // If field doesn't match configuration or is invalid, error is retured. 84 | // Should be called ONLY after the corresponding command is executed. 85 | // MUST NOT be called more than once. 86 | // 87 | // If Player was terminated, special error `ErrorTerminated` 88 | // will be returned. 89 | RetrieveField(field.Configuration) (field.Field, error) 90 | 91 | // Terminates player session. 92 | Close() error 93 | } 94 | 95 | type PlayerFactory interface { 96 | NewPlayer(context.Context) Player 97 | } 98 | 99 | type StopwatchPlayer struct { 100 | player Player 101 | stopwatch *utils.Stopwatch 102 | } 103 | 104 | func NewStopwatchPlayer(player Player, stopwatch *utils.Stopwatch) *StopwatchPlayer { 105 | return &StopwatchPlayer{ 106 | player, 107 | stopwatch, 108 | } 109 | } 110 | 111 | type StopwatchPlayerFactory struct { 112 | playerFactory PlayerFactory 113 | timeout time.Duration 114 | cause error 115 | } 116 | 117 | func NewStopwatchPlayerFactory(playerFactory PlayerFactory, timeout time.Duration, cause error) PlayerFactory { 118 | return &StopwatchPlayerFactory{ 119 | playerFactory, 120 | timeout, 121 | cause, 122 | } 123 | } 124 | 125 | func (f *StopwatchPlayerFactory) NewPlayer(ctx context.Context) Player { 126 | swCtx, sw := utils.NewStopwatchContext(ctx, f.timeout, f.cause) 127 | 128 | player := f.playerFactory.NewPlayer(swCtx) 129 | swPlayer := NewStopwatchPlayer(player, sw) 130 | 131 | return swPlayer 132 | } 133 | 134 | func (p *StopwatchPlayer) SendCommand(command string) (string, error) { 135 | p.stopwatch.Resume() 136 | defer p.stopwatch.Pause() 137 | return p.player.SendCommand(command) 138 | } 139 | 140 | func (p *StopwatchPlayer) RetrieveField(conf field.Configuration) (field.Field, error) { 141 | return p.player.RetrieveField(conf) 142 | } 143 | 144 | func (p *StopwatchPlayer) Close() error { 145 | return p.player.Close() 146 | } 147 | -------------------------------------------------------------------------------- /internal/utils/stopwatch_test.go: -------------------------------------------------------------------------------- 1 | package utils_test 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | "runtime" 7 | "sync/atomic" 8 | "testing" 9 | "time" 10 | 11 | "github.com/stretchr/testify/assert" 12 | 13 | "github.com/mrsobakin/itmournament/internal/utils" 14 | ) 15 | 16 | func TestStopwatch_Close(t *testing.T) { 17 | initialGoroutines := runtime.NumGoroutine() 18 | 19 | var cancelCalled atomic.Bool 20 | cancelFunc := func() { 21 | cancelCalled.Store(true) 22 | } 23 | 24 | sw := utils.NewStopwatch(100*time.Millisecond, cancelFunc) 25 | sw.Close() 26 | sw.Resume() 27 | time.Sleep(200 * time.Millisecond) 28 | sw.Pause() 29 | 30 | assert.False(t, cancelCalled.Load(), "cancel function should not be called") 31 | 32 | finalGoroutines := runtime.NumGoroutine() 33 | 34 | assert.LessOrEqual(t, finalGoroutines, initialGoroutines, "goroutines should not leak") 35 | } 36 | 37 | func TestStopwatch_RepeatClose(t *testing.T) { 38 | var cancelCalled atomic.Bool 39 | cancelFunc := func() { 40 | cancelCalled.Store(true) 41 | } 42 | 43 | sw := utils.NewStopwatch(100*time.Millisecond, cancelFunc) 44 | sw.Close() 45 | assert.NotPanics(t, sw.Close, "Close should not panic on repeated calls") 46 | 47 | assert.False(t, cancelCalled.Load(), "cancel function should be called") 48 | } 49 | 50 | func TestStopwatch_DeadlineUpdate(t *testing.T) { 51 | initialGoroutines := runtime.NumGoroutine() 52 | 53 | var cancelCalled atomic.Bool 54 | sw := utils.NewStopwatch(100*time.Millisecond, func() { 55 | cancelCalled.Store(true) 56 | }) 57 | 58 | defer sw.Close() 59 | 60 | go func() { 61 | time.Sleep(105 * time.Millisecond) 62 | assert.True(t, cancelCalled.Load(), "cancel function should be called immediately") 63 | 64 | finalGoroutines := runtime.NumGoroutine() 65 | 66 | // Compensate for this goroutine 67 | assert.LessOrEqual(t, finalGoroutines-1, initialGoroutines, "goroutines should not leak") 68 | }() 69 | 70 | for i := 0; i < 80; i++ { 71 | sw.Resume() 72 | time.Sleep(time.Millisecond) 73 | sw.Pause() 74 | } 75 | 76 | sw.Resume() 77 | time.Sleep(80 * time.Millisecond) 78 | sw.Pause() 79 | 80 | assert.True(t, cancelCalled.Load(), "cancel function should be called") 81 | } 82 | 83 | func TestStopwatchContext_Timeout(t *testing.T) { 84 | initialGoroutines := runtime.NumGoroutine() 85 | 86 | parentCtx, cancelParent := context.WithCancel(context.Background()) 87 | defer cancelParent() 88 | 89 | cause := errors.New("timeout exceeded") 90 | ctx, sw := utils.NewStopwatchContext(parentCtx, 50*time.Millisecond, cause) 91 | defer sw.Close() 92 | 93 | go func() { 94 | time.Sleep(55 * time.Millisecond) 95 | assert.ErrorIs(t, context.Cause(ctx), cause, "context cancel cause should be the specified cause") 96 | 97 | finalGoroutines := runtime.NumGoroutine() 98 | // Compensate for this goroutine 99 | assert.LessOrEqual(t, finalGoroutines-1, initialGoroutines, "goroutines should not leak") 100 | }() 101 | 102 | sw.Resume() 103 | time.Sleep(100 * time.Millisecond) 104 | sw.Pause() 105 | } 106 | 107 | func TestStopwatchContext_ParentCancel(t *testing.T) { 108 | initialGoroutines := runtime.NumGoroutine() 109 | 110 | parentCtx, cancelParent := context.WithCancel(context.Background()) 111 | 112 | cause := errors.New("timeout exceeded") 113 | ctx, sw := utils.NewStopwatchContext(parentCtx, 200*time.Millisecond, cause) 114 | defer sw.Close() 115 | 116 | go func() { 117 | time.Sleep(50 * time.Millisecond) 118 | cancelParent() 119 | }() 120 | 121 | go func() { 122 | time.Sleep(55 * time.Millisecond) 123 | assert.NotNil(t, ctx.Err(), "child context should be closed") 124 | 125 | finalGoroutines := runtime.NumGoroutine() 126 | // Compensate for this goroutine 127 | assert.LessOrEqual(t, finalGoroutines-1, initialGoroutines, "goroutines should not leak") 128 | }() 129 | 130 | sw.Resume() 131 | time.Sleep(100 * time.Millisecond) 132 | sw.Pause() 133 | } 134 | -------------------------------------------------------------------------------- /internal/docker/runner.go: -------------------------------------------------------------------------------- 1 | package docker 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "io" 7 | "strings" 8 | "sync" 9 | "sync/atomic" 10 | 11 | "github.com/docker/docker/api/types/container" 12 | "github.com/docker/docker/client" 13 | ) 14 | 15 | type SubmissionRunner struct { 16 | cli *client.Client 17 | limits Limits 18 | } 19 | 20 | func NewSubmissionRunner(cli *client.Client, limits Limits) *SubmissionRunner { 21 | return &SubmissionRunner{ 22 | cli, 23 | limits, 24 | } 25 | } 26 | 27 | type RunResult struct { 28 | ExitCode int64 29 | Err error 30 | } 31 | 32 | type ErrorTerminated struct { 33 | Result RunResult 34 | } 35 | 36 | func (e *ErrorTerminated) Error() string { 37 | return fmt.Sprintf("container terminated with [ec: %d, err: %s]", e.Result.ExitCode, e.Result.Err) 38 | } 39 | 40 | type SubmissionContainer struct { 41 | runner *SubmissionRunner 42 | ctx context.Context 43 | id string 44 | 45 | started atomic.Bool 46 | closed atomic.Bool 47 | wg sync.WaitGroup 48 | runResult RunResult 49 | 50 | Stdin io.Writer 51 | Stdout io.Reader 52 | } 53 | 54 | func (r *SubmissionRunner) CreateSubmissionContainer(ctx context.Context, imageName string) (*SubmissionContainer, error) { 55 | stopTimeout := 1 56 | 57 | resp, err := r.cli.ContainerCreate( 58 | ctx, 59 | &container.Config{ 60 | Image: imageName, 61 | NetworkDisabled: true, 62 | AttachStderr: false, 63 | AttachStdin: true, 64 | AttachStdout: true, 65 | Tty: false, 66 | OpenStdin: true, 67 | StopTimeout: &stopTimeout, 68 | }, 69 | &container.HostConfig{ 70 | AutoRemove: true, 71 | RestartPolicy: container.RestartPolicy{ 72 | Name: container.RestartPolicyDisabled, 73 | }, 74 | LogConfig: container.LogConfig{ 75 | Type: "none", 76 | }, 77 | Resources: container.Resources{ 78 | NanoCPUs: int64(r.limits.VCPUs * 1e9), 79 | Memory: r.limits.Memory, 80 | }, 81 | }, 82 | nil, 83 | nil, 84 | "", 85 | ) 86 | 87 | if err != nil { 88 | return nil, err 89 | } 90 | 91 | waiter, err := r.cli.ContainerAttach(ctx, resp.ID, container.AttachOptions{ 92 | Stdout: true, 93 | Stdin: true, 94 | Stream: true, 95 | }) 96 | 97 | if err != nil { 98 | return nil, err 99 | } 100 | 101 | cont := &SubmissionContainer{ 102 | runner: r, 103 | ctx: ctx, 104 | id: resp.ID, 105 | Stdin: waiter.Conn, 106 | } 107 | 108 | cont.Stdout = readerInjectContainerError(newDockerStdoutReader(waiter.Reader), cont) 109 | 110 | return cont, nil 111 | } 112 | 113 | func (c *SubmissionContainer) Start() error { 114 | if !c.started.CompareAndSwap(false, true) { 115 | panic("same container started multiple times") 116 | } 117 | 118 | err := c.runner.cli.ContainerStart(c.ctx, c.id, container.StartOptions{}) 119 | if err != nil { 120 | c.runResult = RunResult{0, err} 121 | c.removeContainer() 122 | return err 123 | } 124 | 125 | c.wg.Add(1) 126 | go func() { 127 | statusChan, errChan := c.runner.cli.ContainerWait(c.ctx, c.id, container.WaitConditionNotRunning) 128 | 129 | select { 130 | case <-c.ctx.Done(): 131 | c.removeContainer() 132 | c.runResult = RunResult{-1, context.Cause(c.ctx)} 133 | case err := <-errChan: 134 | c.runResult = RunResult{-1, err} 135 | case status := <-statusChan: 136 | c.runResult = RunResult{status.StatusCode, nil} 137 | } 138 | c.closed.Store(true) 139 | 140 | c.wg.Done() 141 | }() 142 | 143 | return err 144 | } 145 | 146 | func (c *SubmissionContainer) ReadFile(path string) (io.ReadCloser, error) { 147 | reader, _, err := c.runner.cli.CopyFromContainer(c.ctx, c.id, path) 148 | 149 | if err != nil { 150 | if !client.IsErrNotFound(err) { 151 | return nil, err 152 | } 153 | 154 | // There is no way to unwrap saving message, so we'll use this dirty hack 155 | if !strings.HasPrefix(err.Error(), "Error response from daemon: No such container: ") { 156 | return nil, err 157 | } 158 | 159 | result := c.Wait() 160 | return nil, &ErrorTerminated{result} 161 | } 162 | 163 | untar := newUntarReader(reader) 164 | return untar, nil 165 | } 166 | 167 | func (c *SubmissionContainer) Wait() RunResult { 168 | if !c.started.Load() { 169 | return RunResult{0, fmt.Errorf("container was never started")} 170 | } 171 | 172 | c.wg.Wait() 173 | 174 | return c.runResult 175 | } 176 | 177 | func (c *SubmissionContainer) removeContainer() error { 178 | if !c.closed.CompareAndSwap(false, true) { 179 | return nil 180 | } 181 | 182 | // Use background context because container should be deleted regardless 183 | return c.runner.cli.ContainerRemove(context.Background(), c.id, container.RemoveOptions{ 184 | Force: true, 185 | }) 186 | } 187 | 188 | func (c *SubmissionContainer) Close() error { 189 | err := c.removeContainer() 190 | if err != nil { 191 | return err 192 | } 193 | 194 | c.wg.Wait() 195 | 196 | return nil 197 | } 198 | -------------------------------------------------------------------------------- /internal/judge/judge.go: -------------------------------------------------------------------------------- 1 | package judge 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "errors" 7 | "fmt" 8 | "time" 9 | 10 | "github.com/mrsobakin/itmournament/internal/game" 11 | "github.com/mrsobakin/itmournament/internal/game/field" 12 | ) 13 | 14 | var ( 15 | errTimeoutGlobal = errors.New("global timeout") 16 | errTimeoutMaster = errors.New("master timeout") 17 | errTimeoutSlave = errors.New("slave timeout") 18 | ) 19 | 20 | type Result int 21 | 22 | const ( 23 | Tie Result = iota 24 | MasterWon 25 | SlaveWon 26 | ) 27 | 28 | func (r Result) String() string { 29 | switch r { 30 | case Tie: 31 | return "tie" 32 | case MasterWon: 33 | return "master" 34 | case SlaveWon: 35 | return "slave" 36 | default: 37 | panic("invalid verdict") 38 | } 39 | } 40 | 41 | func (r Result) MarshalJSON() ([]byte, error) { 42 | return json.Marshal(r.String()) 43 | } 44 | 45 | func ResultFromWinner(role game.Role) Result { 46 | if role == game.RoleMaster { 47 | return MasterWon 48 | } 49 | if role == game.RoleSlave { 50 | return SlaveWon 51 | } 52 | panic("unknown role") 53 | } 54 | 55 | type Reason int 56 | 57 | const ( 58 | Ok Reason = iota 59 | RuntimeError 60 | MemoryLimit 61 | Timeout 62 | GlobalTimeout 63 | ) 64 | 65 | func (r Reason) String() string { 66 | switch r { 67 | case Ok: 68 | return "OK" 69 | case RuntimeError: 70 | return "RE" 71 | case MemoryLimit: 72 | return "ML" 73 | case Timeout: 74 | return "TL" 75 | case GlobalTimeout: 76 | return "GTL" 77 | default: 78 | panic("invalid reason") 79 | } 80 | } 81 | 82 | func (r Reason) MarshalJSON() ([]byte, error) { 83 | return json.Marshal(r.String()) 84 | } 85 | 86 | type Verdict struct { 87 | Winner Result `json:"winner"` 88 | Reason Reason `json:"reason"` 89 | Details string `json:"details"` 90 | } 91 | 92 | type Judge struct { 93 | PlayerTimeout time.Duration 94 | GlobalTimeout time.Duration 95 | } 96 | 97 | // As per our rules: 98 | // - If player wins, he wins. 99 | // - If player errors out, the other player wins. 100 | // - If slave loses due to ML, breaker round is 101 | // conducted to determine whether the master 102 | // is able to handle its own configuration. 103 | // - If he can't, it's a tie. 104 | func (j *Judge) judgeMatch(ctx context.Context, masterFactory, slaveFactory game.PlayerFactory) (Result, error) { 105 | var masterField field.Field 106 | var conf field.Configuration 107 | 108 | { 109 | master := masterFactory.NewPlayer(ctx) 110 | slave := slaveFactory.NewPlayer(ctx) 111 | 112 | round := newRound(master, slave) 113 | 114 | result := round.Judge() 115 | if errors.Is(result.Err, errPlayerWon) { 116 | return ResultFromWinner(result.Role), nil 117 | } 118 | 119 | if !errors.Is(result.Err, game.ErrTerminatedMemoryLimit) { 120 | return ResultFromWinner(result.Role.Other()), result.Err 121 | } 122 | 123 | if result.Role == game.RoleMaster { 124 | return SlaveWon, result.Err 125 | } 126 | 127 | masterField = round.masterField 128 | masterField.ResetShots() 129 | conf = round.conf 130 | } 131 | 132 | mockMaster := newMockMaster(masterField, conf) 133 | 134 | master := masterFactory.NewPlayer(ctx) 135 | round := newRound(mockMaster, master) 136 | result := round.Judge() 137 | 138 | // If no errors on master side or master lost. 139 | if result.Role != game.RoleSlave { 140 | return ResultFromWinner(game.RoleMaster), nil 141 | } 142 | 143 | // If master won. 144 | if errors.Is(result.Err, errPlayerWon) { 145 | return ResultFromWinner(game.RoleMaster), nil 146 | } 147 | 148 | // If master had ANY error. 149 | err := fmt.Errorf("error during breaker round: %w", result.Err) 150 | return Tie, err 151 | } 152 | 153 | func (j *Judge) Judge(ctx context.Context, master, slave game.PlayerFactory) Verdict { 154 | swMaster := game.NewStopwatchPlayerFactory(master, j.PlayerTimeout, errTimeoutMaster) 155 | swSlave := game.NewStopwatchPlayerFactory(slave, j.PlayerTimeout, errTimeoutSlave) 156 | 157 | limitedCtx, cancel := context.WithTimeoutCause(ctx, j.GlobalTimeout, errTimeoutGlobal) 158 | defer cancel() 159 | 160 | verdict, details := j.judgeMatch(limitedCtx, swMaster, swSlave) 161 | 162 | reason := func() Reason { 163 | if errors.Is(details, errTimeoutGlobal) { 164 | return GlobalTimeout 165 | } 166 | 167 | if errors.Is(details, errTimeoutMaster) { 168 | verdict = SlaveWon 169 | return Timeout 170 | } 171 | 172 | if errors.Is(details, errTimeoutSlave) { 173 | verdict = MasterWon 174 | return Timeout 175 | } 176 | 177 | if errors.Is(details, game.ErrTerminatedMemoryLimit) { 178 | return MemoryLimit 179 | } 180 | 181 | if details != nil { 182 | return RuntimeError 183 | } 184 | 185 | return Ok 186 | }() 187 | 188 | detailsStr := "" 189 | if details != nil { 190 | detailsStr = details.Error() 191 | } 192 | 193 | return Verdict{ 194 | Winner: verdict, 195 | Reason: reason, 196 | Details: detailsStr, 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /internal/docker/docker_test.go: -------------------------------------------------------------------------------- 1 | package docker_test 2 | 3 | import ( 4 | "archive/tar" 5 | "bufio" 6 | "context" 7 | "errors" 8 | "io" 9 | "net/http" 10 | "net/http/httptest" 11 | "os" 12 | "strconv" 13 | "strings" 14 | "testing" 15 | "time" 16 | 17 | "github.com/docker/docker/client" 18 | "github.com/stretchr/testify/assert" 19 | "github.com/stretchr/testify/require" 20 | 21 | "github.com/mrsobakin/itmournament/internal/docker" 22 | ) 23 | 24 | func mockFileServer(t testing.TB) string { 25 | srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 26 | path := r.URL.Path[1:] 27 | path = strings.TrimSuffix(path, ".tar") 28 | path = "./testdata/" + path 29 | 30 | tw := tar.NewWriter(w) 31 | defer tw.Close() 32 | 33 | tw.AddFS(os.DirFS(path)) 34 | })) 35 | t.Cleanup(srv.Close) 36 | return srv.URL 37 | } 38 | 39 | func buildContainer(t testing.TB, name string) string { 40 | cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) 41 | require.NoError(t, err) 42 | 43 | url := mockFileServer(t) 44 | 45 | ctx := context.Background() 46 | 47 | b, err := docker.NewSubmissionBuilder(cli, ctx, "") 48 | require.NoError(t, err) 49 | 50 | res := b.Build(ctx, docker.Source{ 51 | Src: url + "/" + name + ".tar", 52 | }) 53 | 54 | require.NoError(t, res.Err, "container should build") 55 | 56 | return res.ImageId 57 | } 58 | 59 | func getRunner(t testing.TB, limits docker.Limits) *docker.SubmissionRunner { 60 | cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) 61 | require.NoError(t, err) 62 | 63 | return docker.NewSubmissionRunner(cli, limits) 64 | } 65 | 66 | func getContainer(t testing.TB, ctx context.Context, name string, limits docker.Limits) *docker.SubmissionContainer { 67 | imageId := buildContainer(t, name) 68 | 69 | cont, err := getRunner(t, limits).CreateSubmissionContainer(ctx, imageId) 70 | require.NoError(t, err) 71 | 72 | return cont 73 | } 74 | 75 | func runContainer(t testing.TB, path string, limits docker.Limits) (int64, string) { 76 | cont := getContainer(t, context.Background(), path, limits) 77 | defer cont.Close() 78 | 79 | assert.NoError(t, cont.Start()) 80 | 81 | buf := new(strings.Builder) 82 | io.Copy(buf, cont.Stdout) 83 | 84 | result := cont.Wait() 85 | assert.NoError(t, result.Err) 86 | 87 | return result.ExitCode, strings.TrimSpace(buf.String()) 88 | } 89 | 90 | func Test_Limits_VCPUs(t *testing.T) { 91 | limitsFull := docker.Limits{ 92 | VCPUs: 1, 93 | Memory: 128 * 1024 * 1024, 94 | } 95 | limitsHalf := limitsFull 96 | limitsHalf.VCPUs = 0.5 97 | 98 | ecFull, outFull := runContainer(t, "counter", limitsFull) 99 | valFull, err := strconv.Atoi(outFull) 100 | require.NoError(t, err) 101 | assert.Equal(t, int64(0), ecFull) 102 | t.Logf("Full: %d", valFull) 103 | 104 | ecHalf, outHalf := runContainer(t, "counter", limitsHalf) 105 | valHalf, err := strconv.Atoi(outHalf) 106 | require.NoError(t, err) 107 | assert.Equal(t, int64(0), ecHalf) 108 | t.Logf("Half: %d", valHalf) 109 | 110 | ratio := float64(valHalf) / float64(valFull) 111 | t.Logf("Ratio: %f", ratio) 112 | assert.LessOrEqual(t, ratio, 0.5) 113 | } 114 | 115 | func Test_Limits_Memory(t *testing.T) { 116 | limitsEnough := docker.Limits{ 117 | VCPUs: 1, 118 | Memory: (128 + 6) * 1024 * 1024, 119 | } 120 | limitsInsuff := limitsEnough 121 | limitsInsuff.Memory = 128 * 1024 * 1024 122 | 123 | ecEnough, outEnough := runContainer(t, "memory", limitsEnough) 124 | assert.Equal(t, "ok", outEnough) 125 | assert.Equal(t, int64(0), ecEnough) 126 | 127 | ecInsuff, outInsuff := runContainer(t, "memory", limitsInsuff) 128 | assert.Equal(t, "", outInsuff) 129 | assert.Equal(t, int64(137), ecInsuff) 130 | } 131 | 132 | func Test_ReadFile(t *testing.T) { 133 | cont := getContainer(t, context.Background(), "file", docker.Limits{}) 134 | defer cont.Close() 135 | 136 | require.NoError(t, cont.Start()) 137 | 138 | reader, err := cont.ReadFile("/tmp/file.txt") 139 | assert.NoError(t, err) 140 | 141 | content := new(strings.Builder) 142 | io.Copy(content, reader) 143 | reader.Close() 144 | 145 | cont.Wait() 146 | 147 | assert.Equal(t, "test data", content.String()) 148 | } 149 | 150 | func Test_ContextCancel(t *testing.T) { 151 | ctx, cancel := context.WithCancelCause(context.Background()) 152 | cause := errors.New("timeout") 153 | 154 | cont := getContainer(t, ctx, "counter", docker.Limits{}) 155 | require.NoError(t, cont.Start()) 156 | 157 | time.Sleep(100 * time.Millisecond) 158 | cancel(cause) 159 | 160 | result := cont.Wait() 161 | assert.ErrorIs(t, result.Err, cause) 162 | assert.Equal(t, int64(-1), result.ExitCode) 163 | } 164 | 165 | func Benchmark_Throughput_Lines(b *testing.B) { 166 | cont := getContainer(b, context.Background(), "echo", docker.Limits{}) 167 | require.NoError(b, cont.Start()) 168 | defer cont.Close() 169 | 170 | scanner := bufio.NewScanner(cont.Stdout) 171 | scanner.Split(bufio.ScanLines) 172 | 173 | b.ResetTimer() 174 | for i := 0; i < b.N; i++ { 175 | cont.Stdin.Write([]byte("a\n")) 176 | assert.True(b, scanner.Scan()) 177 | assert.Equal(b, "a", scanner.Text()) 178 | } 179 | b.StopTimer() 180 | } 181 | -------------------------------------------------------------------------------- /internal/game/field/ship_field.go: -------------------------------------------------------------------------------- 1 | package field 2 | 3 | import ( 4 | "errors" 5 | "iter" 6 | 7 | "github.com/dolthub/swiss" 8 | ) 9 | 10 | type shipData uint8 // 1:1:2:4 <-> 1:IsVert:Size:Cells 11 | 12 | func newShipData(isVert bool, size int8) shipData { 13 | var bits = (uint8(size) - 1) << 4 14 | 15 | bits |= (0b1111 << size) & 0b1111 16 | 17 | if isVert { 18 | return shipData(0b11000000 | bits) 19 | } else { 20 | return shipData(0b10000000 | bits) 21 | } 22 | } 23 | 24 | func (c shipData) IsVert() bool { 25 | return ((c >> 6) & 0b1) != 0 26 | } 27 | 28 | func (c shipData) IsHor() bool { 29 | return !c.IsVert() 30 | } 31 | 32 | func (c shipData) Size() int8 { 33 | return int8((c>>4)&0b11) + 1 34 | } 35 | 36 | func (c *shipData) MarkHit(idx int8) { 37 | *c |= (1 << idx) 38 | } 39 | 40 | func (c shipData) IsDead() bool { 41 | return (c & 0b1111) == 0b1111 42 | } 43 | 44 | type packedPos int64 45 | 46 | type intersection struct { 47 | shipPos packedPos 48 | shipData shipData 49 | deck int8 50 | } 51 | 52 | type ShipField struct { 53 | ships *swiss.Map[packedPos, shipData] 54 | conf Configuration 55 | currConfig Configuration 56 | } 57 | 58 | func NewShipField(sizeHint uint32) *ShipField { 59 | return &ShipField{ 60 | ships: swiss.NewMap[packedPos, shipData](sizeHint), 61 | } 62 | } 63 | 64 | func (f *ShipField) makePos(x, y int64) packedPos { 65 | return packedPos(x*f.conf.H + y) 66 | } 67 | 68 | func (f *ShipField) hitShip(ship shipData, pos packedPos, idx int8) ShootResult { 69 | if ship.IsDead() { 70 | return Kill 71 | } 72 | 73 | ship.MarkHit(idx) 74 | 75 | f.ships.Put(pos, ship) 76 | 77 | if ship.IsDead() { 78 | f.currConfig.Sizes[ship.Size()-1] -= 1 79 | return Kill 80 | } else { 81 | return Hit 82 | } 83 | } 84 | 85 | func (f *ShipField) scanIntersectionsLeft(x, y int64) (intersection, bool) { 86 | for i := int8(1); i <= int8(min(3, x)); i++ { 87 | pos := f.makePos(x-int64(i), y) 88 | if ship, exists := f.ships.Get(pos); exists && ship.IsHor() { 89 | if ship.Size() <= i { 90 | continue 91 | } 92 | 93 | return intersection{ 94 | shipPos: pos, 95 | shipData: ship, 96 | deck: i, 97 | }, true 98 | } 99 | } 100 | 101 | var intersection intersection 102 | return intersection, false 103 | } 104 | 105 | func (f *ShipField) scanIntersectionsUp(x, y int64) (intersection, bool) { 106 | for i := int8(1); i <= int8(min(3, y)); i++ { 107 | pos := f.makePos(x, y-int64(i)) 108 | if ship, exists := f.ships.Get(pos); exists && ship.IsVert() { 109 | if ship.Size() <= i { 110 | continue 111 | } 112 | 113 | return intersection{ 114 | shipPos: pos, 115 | shipData: ship, 116 | deck: i, 117 | }, true 118 | } 119 | } 120 | 121 | var intersection intersection 122 | return intersection, false 123 | } 124 | 125 | // Checks whether there are ships that take start inside the given ship or its border. 126 | // Returns true if there are such ships, i.e. there are intersections. 127 | func (f *ShipField) checkInnerOverlaps(ship Ship) bool { 128 | minX := max(0, ship.X-1) 129 | minY := max(0, ship.Y-1) 130 | 131 | var maxX, maxY int64 132 | if ship.IsVert { 133 | maxX = min(f.conf.W-1, ship.X+1) 134 | maxY = min(f.conf.H-1, ship.Y+int64(ship.Size)) 135 | } else { 136 | maxX = min(f.conf.W-1, ship.X+int64(ship.Size)) 137 | maxY = min(f.conf.H-1, ship.Y+1) 138 | } 139 | 140 | for x := minX; x <= maxX; x++ { 141 | for y := minY; y <= maxY; y++ { 142 | if f.ships.Has(f.makePos(x, y)) { 143 | return true 144 | } 145 | } 146 | } 147 | 148 | return false 149 | } 150 | 151 | func (f *ShipField) checkOuterLeftOverlaps(ship Ship) bool { 152 | x := max(0, ship.X-1) 153 | minY := max(0, ship.Y-1) 154 | 155 | var maxY int64 156 | if ship.IsVert { 157 | maxY = min(f.conf.H-1, ship.Y+int64(ship.Size)) 158 | } else { 159 | maxY = min(f.conf.H-1, ship.Y+1) 160 | } 161 | 162 | for y := minY; y <= maxY; y++ { 163 | if _, found := f.scanIntersectionsLeft(x, y); found { 164 | return true 165 | } 166 | } 167 | 168 | return false 169 | } 170 | 171 | func (f *ShipField) checkOuterUpOverlaps(ship Ship) bool { 172 | y := max(0, ship.Y-1) 173 | minX := max(0, ship.X-1) 174 | 175 | var maxX int64 176 | if ship.IsVert { 177 | maxX = min(f.conf.W-1, ship.X+1) 178 | } else { 179 | maxX = min(f.conf.W-1, ship.X+int64(ship.Size)) 180 | } 181 | 182 | for x := minX; x <= maxX; x++ { 183 | if _, found := f.scanIntersectionsUp(x, y); found { 184 | return true 185 | } 186 | } 187 | 188 | return false 189 | } 190 | 191 | func (f *ShipField) Load(conf Configuration, ships iter.Seq[Ship]) error { 192 | cellCounts := make([]int64, len(conf.Sizes)) 193 | f.currConfig = conf 194 | f.conf = conf 195 | 196 | if conf.W == 0 || conf.H == 0 { 197 | return errors.New("invalid field size") 198 | } 199 | 200 | for ship := range ships { 201 | if ship.Size <= 0 || int(ship.Size) > len(conf.Sizes) { 202 | return errors.New("invalid ship size") 203 | } 204 | 205 | if ship.IsVert { 206 | if ship.X >= conf.W || ship.Y+int64(ship.Size) > conf.H { 207 | return errors.New("ship out of bounds") 208 | } 209 | } else { 210 | if ship.Y >= conf.H || ship.X+int64(ship.Size) > conf.W { 211 | return errors.New("ship out of bounds") 212 | } 213 | } 214 | 215 | if f.checkInnerOverlaps(ship) || f.checkOuterLeftOverlaps(ship) || f.checkOuterUpOverlaps(ship) { 216 | return errors.New("ships overlap") 217 | } 218 | 219 | pos := f.makePos(ship.X, ship.Y) 220 | f.ships.Put(pos, newShipData(ship.IsVert, ship.Size)) 221 | 222 | cellCounts[ship.Size-1]++ 223 | } 224 | 225 | for i, count := range cellCounts { 226 | if count != conf.Sizes[i] { 227 | return errors.New("ship count does not match configuration") 228 | } 229 | } 230 | 231 | return nil 232 | } 233 | 234 | func (f *ShipField) Shoot(x, y int64) ShootResult { 235 | if x >= f.conf.W || y >= f.conf.H { 236 | return Miss 237 | } 238 | 239 | pos := f.makePos(x, y) 240 | if ship, exists := f.ships.Get(pos); exists { 241 | return f.hitShip(ship, pos, 0) 242 | } 243 | 244 | if intr, found := f.scanIntersectionsLeft(x, y); found { 245 | return f.hitShip(intr.shipData, intr.shipPos, intr.deck) 246 | } 247 | 248 | if intr, found := f.scanIntersectionsUp(x, y); found { 249 | return f.hitShip(intr.shipData, intr.shipPos, intr.deck) 250 | } 251 | 252 | return Miss 253 | } 254 | 255 | func (f *ShipField) ResetShots() { 256 | f.currConfig = f.conf 257 | f.ships.Iter(func(pos packedPos, oldShip shipData) (stop bool) { 258 | f.ships.Put(pos, newShipData(oldShip.IsVert(), oldShip.Size())) 259 | return 260 | }) 261 | } 262 | 263 | func (f *ShipField) AllDead() bool { 264 | return f.currConfig.Sizes[0] == 0 && 265 | f.currConfig.Sizes[1] == 0 && 266 | f.currConfig.Sizes[2] == 0 && 267 | f.currConfig.Sizes[3] == 0 268 | } 269 | -------------------------------------------------------------------------------- /internal/judge/match.go: -------------------------------------------------------------------------------- 1 | package judge 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | 7 | "github.com/mrsobakin/itmournament/internal/game" 8 | "github.com/mrsobakin/itmournament/internal/game/field" 9 | ) 10 | 11 | var ( 12 | errPlayerWon error = errors.New("player won") 13 | ) 14 | 15 | type roleError struct { 16 | Role game.Role 17 | Err error 18 | } 19 | 20 | func failedAs(role game.Role, err error) *roleError { 21 | return &roleError{ 22 | role, 23 | err, 24 | } 25 | } 26 | 27 | func wonAs(role game.Role) *roleError { 28 | return &roleError{ 29 | role, 30 | errPlayerWon, 31 | } 32 | } 33 | 34 | type round struct { 35 | master, slave game.PlayerExt 36 | masterField, slaveField field.Field 37 | conf field.Configuration 38 | } 39 | 40 | func newRound(master, slave game.Player) *round { 41 | return &round{ 42 | master: game.PlayerExt{ 43 | Player: master, 44 | }, 45 | slave: game.PlayerExt{ 46 | Player: slave, 47 | }, 48 | } 49 | } 50 | 51 | func (r *round) playerByRole(role game.Role) game.PlayerExt { 52 | if role == game.RoleMaster { 53 | return r.master 54 | } else { 55 | return r.slave 56 | } 57 | } 58 | 59 | func (r *round) fieldByRole(role game.Role) field.Field { 60 | if role == game.RoleMaster { 61 | return r.masterField 62 | } else { 63 | return r.slaveField 64 | } 65 | } 66 | 67 | func (r *round) InitPlayer(role game.Role) *roleError { 68 | player := r.playerByRole(role) 69 | 70 | resp, err := player.SendCommand("create " + role.String()) 71 | if err != nil { 72 | return failedAs(role, fmt.Errorf("failed to create role: %w", err)) 73 | } 74 | if resp != "ok" { 75 | return failedAs(role, fmt.Errorf("failed to create role, returned: %q", resp)) 76 | } 77 | 78 | resp, err = player.SendCommand("set strategy custom") 79 | if err != nil { 80 | return failedAs(role, fmt.Errorf("failed to set strategy: %w", err)) 81 | } 82 | if resp != "ok" { 83 | return failedAs(role, fmt.Errorf("failed to set strategy, returned: %q", resp)) 84 | } 85 | 86 | return nil 87 | } 88 | 89 | func (r *round) confParams() []struct { 90 | name string 91 | val *int64 92 | } { 93 | return []struct { 94 | name string 95 | val *int64 96 | }{ 97 | {"width", &r.conf.W}, 98 | {"height", &r.conf.H}, 99 | {"count 1", &r.conf.Sizes[0]}, 100 | {"count 2", &r.conf.Sizes[1]}, 101 | {"count 3", &r.conf.Sizes[2]}, 102 | {"count 4", &r.conf.Sizes[3]}, 103 | } 104 | } 105 | 106 | func (r *round) RequestConfiguration() *roleError { 107 | for _, arg := range r.confParams() { 108 | if err := r.master.SendScanf("get "+arg.name, "%d", arg.val); err != nil { 109 | return failedAs(game.RoleMaster, fmt.Errorf("failed to get configuration: %w", err)) 110 | } 111 | } 112 | 113 | if err := r.conf.IsValid(); err != nil { 114 | return failedAs(game.RoleMaster, fmt.Errorf("invalid configuration: %w", err)) 115 | } 116 | 117 | return nil 118 | } 119 | 120 | func (r *round) TransferConfiguration() *roleError { 121 | for _, arg := range r.confParams() { 122 | resp, err := r.slave.Sendf("set %s %d", arg.name, *arg.val) 123 | if err != nil { 124 | return failedAs(game.RoleSlave, fmt.Errorf("failed to set configuration: %w", err)) 125 | } 126 | if resp != "ok" { 127 | return failedAs(game.RoleSlave, fmt.Errorf("failed to set configuration, returned: %q", resp)) 128 | } 129 | } 130 | 131 | return nil 132 | } 133 | 134 | func (r *round) StartPlayer(role game.Role) *roleError { 135 | player := r.playerByRole(role) 136 | 137 | resp, err := player.SendCommand("start") 138 | if err != nil { 139 | return failedAs(role, fmt.Errorf("failed to start: %w", err)) 140 | } 141 | if resp != "ok" { 142 | return failedAs(role, fmt.Errorf("failed to start, returned: %q", resp)) 143 | } 144 | 145 | if role == game.RoleMaster { 146 | r.masterField, err = player.RequestAndGetField(r.conf) 147 | } else { 148 | r.slaveField, err = player.RequestAndGetField(r.conf) 149 | } 150 | if err != nil { 151 | return failedAs(role, fmt.Errorf("failed to get field: %w", err)) 152 | } 153 | 154 | return nil 155 | } 156 | 157 | func (r *round) isValidShot(x, y int64) bool { 158 | return x >= 0 && y >= 0 && x < r.conf.W && y < r.conf.H 159 | } 160 | 161 | func (r *round) Shoot(shooterRole game.Role) (bool, *roleError) { 162 | victimRole := shooterRole.Other() 163 | 164 | shooter := r.playerByRole(shooterRole) 165 | victim := r.playerByRole(victimRole) 166 | 167 | victimField := r.fieldByRole(victimRole) 168 | 169 | var x, y int64 170 | if err := shooter.SendScanf("shot", "%d %d", &x, &y); err != nil { 171 | return false, failedAs(shooterRole, fmt.Errorf("failed to request shoot coordinaes: %w", err)) 172 | } 173 | 174 | if !r.isValidShot(x, y) { 175 | return false, failedAs(shooterRole, fmt.Errorf("invalid shoot position %d %d", x, y)) 176 | } 177 | 178 | resp, err := victim.Sendf("shot %d %d", x, y) 179 | if err != nil { 180 | return false, failedAs(victimRole, fmt.Errorf("failed to shoot: %w", err)) 181 | } 182 | 183 | var result field.ShootResult 184 | if err := result.FromString(resp); err != nil { 185 | return false, failedAs(victimRole, err) 186 | } 187 | 188 | expectedResult := victimField.Shoot(x, y) 189 | 190 | if result != expectedResult { 191 | return false, failedAs(victimRole, fmt.Errorf("victim returned invalid shoot result: %d", result)) 192 | } 193 | 194 | resp, err = shooter.Sendf("set result %s", resp) 195 | if err != nil { 196 | return false, failedAs(shooterRole, fmt.Errorf("failed to set shoot result: %w", err)) 197 | } 198 | if resp != "ok" { 199 | return false, failedAs(shooterRole, fmt.Errorf("failed to set shoot result, returned: %q", resp)) 200 | } 201 | 202 | var hit bool 203 | if !victimField.AllDead() { 204 | hit = (result != field.Miss) 205 | return hit, nil 206 | } 207 | 208 | return true, wonAs(shooterRole) 209 | } 210 | 211 | func (r *round) Judge() *roleError { 212 | if err := r.InitPlayer(game.RoleMaster); err != nil { 213 | return err 214 | } 215 | 216 | if err := r.InitPlayer(game.RoleSlave); err != nil { 217 | return err 218 | } 219 | 220 | if err := r.RequestConfiguration(); err != nil { 221 | return err 222 | } 223 | 224 | if err := r.StartPlayer(game.RoleMaster); err != nil { 225 | return err 226 | } 227 | 228 | // Just in case, configuration is transfered onto slave only after 229 | // master field is dumped and checked. 230 | // This prevents master from asking slave for fields it 231 | // itself is unable to generate. 232 | if err := r.TransferConfiguration(); err != nil { 233 | return err 234 | } 235 | 236 | if err := r.StartPlayer(game.RoleSlave); err != nil { 237 | return err 238 | } 239 | 240 | currentPlayer := game.RoleSlave 241 | for { 242 | hit, err := r.Shoot(currentPlayer) 243 | if err != nil { 244 | return err 245 | } 246 | 247 | if !hit { 248 | currentPlayer = currentPlayer.Other() 249 | } 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/mrsobakin/itmournament 2 | 3 | go 1.23.3 4 | 5 | require ( 6 | github.com/docker/buildx v0.19.2 7 | github.com/docker/docker v27.4.0+incompatible 8 | github.com/dolthub/swiss v0.2.1 9 | github.com/gin-gonic/gin v1.10.0 10 | github.com/moby/buildkit v0.18.1 11 | github.com/stretchr/testify v1.10.0 12 | golang.org/x/sync v0.8.0 13 | ) 14 | 15 | require ( 16 | github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect 17 | github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect 18 | github.com/Masterminds/semver/v3 v3.2.1 // indirect 19 | github.com/Microsoft/go-winio v0.6.2 // indirect 20 | github.com/Microsoft/hcsshim v0.12.8 // indirect 21 | github.com/agext/levenshtein v1.2.3 // indirect 22 | github.com/beorn7/perks v1.0.1 // indirect 23 | github.com/bytedance/sonic v1.11.6 // indirect 24 | github.com/bytedance/sonic/loader v0.1.1 // indirect 25 | github.com/cenkalti/backoff/v4 v4.3.0 // indirect 26 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 27 | github.com/cloudwego/base64x v0.1.4 // indirect 28 | github.com/cloudwego/iasm v0.2.0 // indirect 29 | github.com/containerd/cgroups/v3 v3.0.3 // indirect 30 | github.com/containerd/console v1.0.4 // indirect 31 | github.com/containerd/containerd v1.7.24 // indirect 32 | github.com/containerd/containerd/api v1.7.19 // indirect 33 | github.com/containerd/continuity v0.4.5 // indirect 34 | github.com/containerd/errdefs v0.3.0 // indirect 35 | github.com/containerd/fifo v1.1.0 // indirect 36 | github.com/containerd/log v0.1.0 // indirect 37 | github.com/containerd/nydus-snapshotter v0.14.0 // indirect 38 | github.com/containerd/platforms v0.2.1 // indirect 39 | github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect 40 | github.com/containerd/ttrpc v1.2.5 // indirect 41 | github.com/containerd/typeurl/v2 v2.2.3 // indirect 42 | github.com/davecgh/go-spew v1.1.1 // indirect 43 | github.com/distribution/reference v0.6.0 // indirect 44 | github.com/docker/cli v27.4.0-rc.2+incompatible // indirect 45 | github.com/docker/distribution v2.8.3+incompatible // indirect 46 | github.com/docker/docker-credential-helpers v0.8.2 // indirect 47 | github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect 48 | github.com/docker/go-connections v0.5.0 // indirect 49 | github.com/docker/go-metrics v0.0.1 // indirect 50 | github.com/docker/go-units v0.5.0 // indirect 51 | github.com/dolthub/maphash v0.1.0 // indirect 52 | github.com/felixge/httpsnoop v1.0.4 // indirect 53 | github.com/fvbommel/sortorder v1.0.1 // indirect 54 | github.com/gabriel-vasile/mimetype v1.4.3 // indirect 55 | github.com/gin-contrib/sse v0.1.0 // indirect 56 | github.com/go-logr/logr v1.4.2 // indirect 57 | github.com/go-logr/stdr v1.2.2 // indirect 58 | github.com/go-playground/locales v0.14.1 // indirect 59 | github.com/go-playground/universal-translator v0.18.1 // indirect 60 | github.com/go-playground/validator/v10 v10.20.0 // indirect 61 | github.com/goccy/go-json v0.10.2 // indirect 62 | github.com/gofrs/flock v0.12.1 // indirect 63 | github.com/gogo/protobuf v1.3.2 // indirect 64 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect 65 | github.com/golang/protobuf v1.5.4 // indirect 66 | github.com/google/go-cmp v0.6.0 // indirect 67 | github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect 68 | github.com/google/uuid v1.6.0 // indirect 69 | github.com/gorilla/mux v1.8.1 // indirect 70 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect 71 | github.com/hashicorp/errwrap v1.1.0 // indirect 72 | github.com/hashicorp/go-multierror v1.1.1 // indirect 73 | github.com/in-toto/in-toto-golang v0.5.0 // indirect 74 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 75 | github.com/json-iterator/go v1.1.12 // indirect 76 | github.com/klauspost/compress v1.17.11 // indirect 77 | github.com/klauspost/cpuid/v2 v2.2.7 // indirect 78 | github.com/leodido/go-urn v1.4.0 // indirect 79 | github.com/mattn/go-isatty v0.0.20 // indirect 80 | github.com/miekg/pkcs11 v1.1.1 // indirect 81 | github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect 82 | github.com/moby/docker-image-spec v1.3.1 // indirect 83 | github.com/moby/locker v1.0.1 // indirect 84 | github.com/moby/patternmatcher v0.6.0 // indirect 85 | github.com/moby/sys/mountinfo v0.7.2 // indirect 86 | github.com/moby/sys/sequential v0.6.0 // indirect 87 | github.com/moby/sys/signal v0.7.1 // indirect 88 | github.com/moby/sys/user v0.3.0 // indirect 89 | github.com/moby/sys/userns v0.1.0 // indirect 90 | github.com/moby/term v0.5.0 // indirect 91 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 92 | github.com/modern-go/reflect2 v1.0.2 // indirect 93 | github.com/morikuni/aec v1.0.0 // indirect 94 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 95 | github.com/opencontainers/go-digest v1.0.0 // indirect 96 | github.com/opencontainers/image-spec v1.1.0 // indirect 97 | github.com/pelletier/go-toml v1.9.5 // indirect 98 | github.com/pelletier/go-toml/v2 v2.2.2 // indirect 99 | github.com/pkg/errors v0.9.1 // indirect 100 | github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect 101 | github.com/pmezard/go-difflib v1.0.0 // indirect 102 | github.com/prometheus/client_golang v1.20.2 // indirect 103 | github.com/prometheus/client_model v0.6.1 // indirect 104 | github.com/prometheus/common v0.55.0 // indirect 105 | github.com/prometheus/procfs v0.15.1 // indirect 106 | github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect 107 | github.com/shibumi/go-pathspec v1.3.0 // indirect 108 | github.com/sirupsen/logrus v1.9.3 // indirect 109 | github.com/spf13/cobra v1.8.1 // indirect 110 | github.com/spf13/pflag v1.0.5 // indirect 111 | github.com/theupdateframework/notary v0.7.0 // indirect 112 | github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 // indirect 113 | github.com/tonistiigi/fsutil v0.0.0-20241121093142-31cf1f437184 // indirect 114 | github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 // indirect 115 | github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect 116 | github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect 117 | github.com/twitchyliquid64/golang-asm v0.15.1 // indirect 118 | github.com/ugorji/go/codec v1.2.12 // indirect 119 | github.com/vbatts/tar-split v0.11.6 // indirect 120 | go.opencensus.io v0.24.0 // indirect 121 | go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect 122 | go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 // indirect 123 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 // indirect 124 | go.opentelemetry.io/otel v1.32.0 // indirect 125 | go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 // indirect 126 | go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect 127 | go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect 128 | go.opentelemetry.io/otel/metric v1.32.0 // indirect 129 | go.opentelemetry.io/otel/sdk v1.28.0 // indirect 130 | go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect 131 | go.opentelemetry.io/otel/trace v1.32.0 // indirect 132 | go.opentelemetry.io/proto/otlp v1.3.1 // indirect 133 | golang.org/x/arch v0.8.0 // indirect 134 | golang.org/x/crypto v0.27.0 // indirect 135 | golang.org/x/net v0.29.0 // indirect 136 | golang.org/x/sys v0.26.0 // indirect 137 | golang.org/x/term v0.24.0 // indirect 138 | golang.org/x/text v0.18.0 // indirect 139 | golang.org/x/time v0.6.0 // indirect 140 | google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect 141 | google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect 142 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect 143 | google.golang.org/grpc v1.66.3 // indirect 144 | google.golang.org/protobuf v1.35.1 // indirect 145 | gopkg.in/yaml.v3 v3.0.1 // indirect 146 | gotest.tools/v3 v3.5.1 // indirect 147 | ) 148 | -------------------------------------------------------------------------------- /internal/game/field/field_test.go: -------------------------------------------------------------------------------- 1 | package field_test 2 | 3 | import ( 4 | "bytes" 5 | _ "embed" 6 | "math/rand" 7 | "slices" 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | "github.com/stretchr/testify/require" 12 | 13 | "github.com/mrsobakin/itmournament/internal/game/field" 14 | ) 15 | 16 | //go:embed testdata/field.txt 17 | var txtFuzzField []byte 18 | 19 | //go:embed testdata/dense.txt 20 | var txtDenseField []byte 21 | 22 | func RunFieldTests(t *testing.T, newField func() field.Field) { 23 | t.Run("Load_ValidConfiguration", func(t *testing.T) { 24 | f := newField() 25 | conf := field.Configuration{ 26 | W: 10, 27 | H: 10, 28 | Sizes: [4]int64{1, 1, 0, 0}, 29 | } 30 | 31 | ships := slices.Values([]field.Ship{ 32 | {X: 0, Y: 0, Size: 2, IsVert: false}, 33 | {X: 9, Y: 9, Size: 1, IsVert: false}, 34 | }) 35 | 36 | err := f.Load(conf, ships) 37 | assert.NoError(t, err, "expected no error for valid configuration") 38 | }) 39 | 40 | t.Run("Load_MismatchedShipCounts", func(t *testing.T) { 41 | f := newField() 42 | conf := field.Configuration{ 43 | W: 5, 44 | H: 5, 45 | Sizes: [4]int64{2, 0, 1, 0}, 46 | } 47 | 48 | ships := slices.Values([]field.Ship{ 49 | {X: 0, Y: 0, Size: 1, IsVert: false}, 50 | }) 51 | 52 | err := f.Load(conf, ships) 53 | assert.Error(t, err, "expected error for mismatched ship counts") 54 | }) 55 | 56 | // . . . 57 | // . A A x x 58 | // . . . 59 | t.Run("Load_OutOfBoundsShips", func(t *testing.T) { 60 | f := newField() 61 | conf := field.Configuration{ 62 | W: 3, 63 | H: 3, 64 | Sizes: [4]int64{0, 0, 0, 1}, 65 | } 66 | 67 | ships := slices.Values([]field.Ship{ 68 | {X: 1, Y: 1, Size: 4, IsVert: false}, 69 | }) 70 | 71 | err := f.Load(conf, ships) 72 | assert.Error(t, err, "expected error for out-of-bounds ships") 73 | }) 74 | 75 | // . . . 76 | // . . . A 77 | // . . . 78 | t.Run("Load_OutOfBoundsShips", func(t *testing.T) { 79 | f := newField() 80 | conf := field.Configuration{ 81 | W: 3, 82 | H: 3, 83 | Sizes: [4]int64{1, 0, 0, 0}, 84 | } 85 | 86 | ships := slices.Values([]field.Ship{ 87 | {X: 3, Y: 1, Size: 4, IsVert: false}, 88 | }) 89 | 90 | err := f.Load(conf, ships) 91 | assert.Error(t, err, "expected error for out-of-bounds ships") 92 | }) 93 | 94 | // . . B . . 95 | // A A X A . 96 | // . . B . . 97 | // . . B . . 98 | // . . . . . 99 | t.Run("Load_IntersectingShips", func(t *testing.T) { 100 | f := newField() 101 | conf := field.Configuration{ 102 | W: 5, 103 | H: 5, 104 | Sizes: [4]int64{0, 0, 0, 2}, 105 | } 106 | 107 | ships := slices.Values([]field.Ship{ 108 | {X: 0, Y: 1, Size: 4, IsVert: false}, 109 | {X: 2, Y: 0, Size: 4, IsVert: true}, 110 | }) 111 | 112 | err := f.Load(conf, ships) 113 | assert.Error(t, err, "expected error for intersecting ships") 114 | }) 115 | 116 | // A . . 117 | // . B . 118 | // . . . 119 | t.Run("Load_ShipsTouchingCorners", func(t *testing.T) { 120 | f := newField() 121 | conf := field.Configuration{ 122 | W: 3, 123 | H: 3, 124 | Sizes: [4]int64{2, 0, 0, 0}, 125 | } 126 | 127 | ships := slices.Values([]field.Ship{ 128 | {X: 0, Y: 0, Size: 1, IsVert: false}, 129 | {X: 1, Y: 1, Size: 1, IsVert: false}, 130 | }) 131 | 132 | err := f.Load(conf, ships) 133 | assert.Error(t, err, "expected error for ships touching borders") 134 | }) 135 | 136 | // . . . . . 137 | // . . . . . 138 | // A A A . . 139 | // . . . B . 140 | // . . . B . 141 | t.Run("Load_MulticellShipsTouchingCorners", func(t *testing.T) { 142 | f := newField() 143 | conf := field.Configuration{ 144 | W: 5, 145 | H: 5, 146 | Sizes: [4]int64{0, 1, 1, 0}, 147 | } 148 | 149 | ships := slices.Values([]field.Ship{ 150 | {X: 0, Y: 2, Size: 3, IsVert: false}, 151 | {X: 3, Y: 3, Size: 2, IsVert: true}, 152 | }) 153 | 154 | err := f.Load(conf, ships) 155 | assert.Error(t, err, "expected error for ships touching borders") 156 | }) 157 | 158 | // . . . . . 159 | // . . . . . 160 | // B B B . . 161 | // . . . A . 162 | // . . . A . 163 | t.Run("Load_MulticellShipsTouchingCorners", func(t *testing.T) { 164 | f := newField() 165 | conf := field.Configuration{ 166 | W: 5, 167 | H: 5, 168 | Sizes: [4]int64{0, 1, 1, 0}, 169 | } 170 | 171 | ships := slices.Values([]field.Ship{ 172 | {X: 3, Y: 3, Size: 2, IsVert: true}, 173 | {X: 0, Y: 2, Size: 3, IsVert: false}, 174 | }) 175 | 176 | err := f.Load(conf, ships) 177 | assert.Error(t, err, "expected error for ships touching borders") 178 | }) 179 | 180 | // . . . 181 | // . B A 182 | // . . . 183 | t.Run("Load_ShipsTouchingBorders", func(t *testing.T) { 184 | f := newField() 185 | conf := field.Configuration{ 186 | W: 3, 187 | H: 3, 188 | Sizes: [4]int64{2, 0, 0, 0}, 189 | } 190 | 191 | ships := slices.Values([]field.Ship{ 192 | {X: 2, Y: 1, Size: 1, IsVert: false}, 193 | {X: 1, Y: 1, Size: 1, IsVert: false}, 194 | }) 195 | 196 | err := f.Load(conf, ships) 197 | assert.Error(t, err, "expected error for ships touching borders") 198 | }) 199 | 200 | // . . . . . 201 | // A A A . . 202 | // . . B B . 203 | // . . . . . 204 | // . . . . . 205 | t.Run("Load_MulticellShipsTouchingBorders", func(t *testing.T) { 206 | f := newField() 207 | conf := field.Configuration{ 208 | W: 5, 209 | H: 5, 210 | Sizes: [4]int64{0, 1, 1, 0}, 211 | } 212 | 213 | ships := slices.Values([]field.Ship{ 214 | {X: 0, Y: 1, Size: 3, IsVert: false}, 215 | {X: 2, Y: 2, Size: 2, IsVert: false}, 216 | }) 217 | 218 | err := f.Load(conf, ships) 219 | assert.Error(t, err, "expected error for ships touching borders") 220 | }) 221 | 222 | // . . . 223 | // . . . 224 | // . . . 225 | t.Run("Shoot_EmptyCell", func(t *testing.T) { 226 | f := newField() 227 | conf := field.Configuration{W: 3, H: 3, Sizes: [4]int64{0, 0, 0, 0}} 228 | require.NoError(t, f.Load(conf, slices.Values([]field.Ship{}))) 229 | 230 | result := f.Shoot(1, 1) 231 | assert.Equal(t, field.Miss, result, "expected Miss for empty cell") 232 | }) 233 | 234 | // . . . 235 | // . A . 236 | // . . . 237 | t.Run("Shoot_DestroyShip", func(t *testing.T) { 238 | f := newField() 239 | conf := field.Configuration{ 240 | W: 3, 241 | H: 3, 242 | Sizes: [4]int64{1, 0, 0, 0}, 243 | } 244 | 245 | ships := slices.Values([]field.Ship{ 246 | {X: 1, Y: 1, Size: 1, IsVert: false}, 247 | }) 248 | 249 | require.NoError(t, f.Load(conf, ships)) 250 | 251 | result := f.Shoot(1, 1) 252 | assert.Equal(t, field.Kill, result, "expected Kill for destroying a ship") 253 | }) 254 | 255 | // . . . 256 | // . A . 257 | // . . . 258 | t.Run("Shoot_Repeatedly", func(t *testing.T) { 259 | f := newField() 260 | conf := field.Configuration{ 261 | W: 3, 262 | H: 3, 263 | Sizes: [4]int64{1, 0, 0, 0}, 264 | } 265 | 266 | ships := slices.Values([]field.Ship{ 267 | {X: 1, Y: 1, Size: 1, IsVert: false}, 268 | }) 269 | 270 | require.NoError(t, f.Load(conf, ships)) 271 | 272 | result := f.Shoot(1, 1) 273 | assert.Equal(t, field.Kill, result, "expected Hit on first shot") 274 | 275 | result = f.Shoot(1, 1) 276 | assert.Equal(t, field.Kill, result, "expected Kill on repeated shot at same cell") 277 | }) 278 | 279 | // A . . 280 | // A . . 281 | // . . . 282 | t.Run("Shoot_DestroyMulticellShip", func(t *testing.T) { 283 | f := newField() 284 | conf := field.Configuration{ 285 | W: 3, 286 | H: 3, 287 | Sizes: [4]int64{0, 1, 0, 0}, 288 | } 289 | 290 | ships := slices.Values([]field.Ship{ 291 | {X: 0, Y: 0, Size: 2, IsVert: true}, 292 | }) 293 | 294 | require.NoError(t, f.Load(conf, ships)) 295 | 296 | assert.Equal(t, field.Hit, f.Shoot(0, 0), "expected Hit on first shot at multicell ship") 297 | assert.Equal(t, field.Kill, f.Shoot(0, 1), "expected Kill when entire multicell ship is destroyed") 298 | }) 299 | 300 | // A A A A . B 301 | // . . . . . B 302 | // E . . F . B 303 | // E . . . . B 304 | // . . . . . . 305 | // D D D . C C 306 | t.Run("Shoot_RealField", func(t *testing.T) { 307 | f := newField() 308 | conf := field.Configuration{ 309 | W: 6, 310 | H: 6, 311 | Sizes: [4]int64{1, 2, 1, 2}, 312 | } 313 | 314 | ships := slices.Values([]field.Ship{ 315 | {X: 0, Y: 0, Size: 4, IsVert: false}, 316 | {X: 5, Y: 0, Size: 4, IsVert: true}, 317 | {X: 4, Y: 5, Size: 2, IsVert: false}, 318 | {X: 0, Y: 5, Size: 3, IsVert: false}, 319 | {X: 0, Y: 2, Size: 2, IsVert: true}, 320 | {X: 3, Y: 2, Size: 1, IsVert: false}, 321 | }) 322 | 323 | require.NoError(t, f.Load(conf, ships)) 324 | 325 | assert.False(t, f.AllDead()) 326 | 327 | // Some empty cells 328 | assert.Equal(t, field.Miss, f.Shoot(4, 0)) 329 | assert.Equal(t, field.Miss, f.Shoot(0, 1)) 330 | assert.Equal(t, field.Miss, f.Shoot(3, 1)) 331 | assert.Equal(t, field.Miss, f.Shoot(3, 5)) 332 | assert.False(t, f.AllDead()) 333 | 334 | // E 335 | assert.Equal(t, field.Hit, f.Shoot(0, 2)) 336 | assert.Equal(t, field.Kill, f.Shoot(0, 3)) 337 | assert.False(t, f.AllDead()) 338 | 339 | // B 340 | assert.Equal(t, field.Hit, f.Shoot(5, 2)) 341 | assert.Equal(t, field.Hit, f.Shoot(5, 0)) 342 | assert.Equal(t, field.Hit, f.Shoot(5, 3)) 343 | assert.Equal(t, field.Kill, f.Shoot(5, 1)) 344 | assert.False(t, f.AllDead()) 345 | 346 | // F 347 | assert.Equal(t, field.Kill, f.Shoot(3, 2)) 348 | assert.False(t, f.AllDead()) 349 | 350 | // C 351 | assert.Equal(t, field.Hit, f.Shoot(4, 5)) 352 | assert.Equal(t, field.Kill, f.Shoot(5, 5)) 353 | assert.False(t, f.AllDead()) 354 | 355 | // A 356 | assert.Equal(t, field.Hit, f.Shoot(3, 0)) 357 | assert.Equal(t, field.Hit, f.Shoot(1, 0)) 358 | assert.Equal(t, field.Hit, f.Shoot(2, 0)) 359 | assert.Equal(t, field.Kill, f.Shoot(0, 0)) 360 | assert.False(t, f.AllDead()) 361 | 362 | // D 363 | assert.Equal(t, field.Hit, f.Shoot(2, 5)) 364 | assert.False(t, f.AllDead()) 365 | assert.Equal(t, field.Hit, f.Shoot(0, 5)) 366 | assert.False(t, f.AllDead()) 367 | assert.Equal(t, field.Kill, f.Shoot(1, 5)) 368 | 369 | assert.True(t, f.AllDead()) 370 | }) 371 | 372 | t.Run("Shoot_Fuzzy", func(t *testing.T) { 373 | f := newField() 374 | conf := field.Configuration{ 375 | W: 500, 376 | H: 500, 377 | Sizes: [4]int64{14800, 11100, 7400, 3700}, 378 | } 379 | 380 | ships := field.ParseShips(bytes.NewReader(txtFuzzField)) 381 | 382 | require.NoError(t, f.Load(conf, ships)) 383 | 384 | type pos struct{ x, y int } 385 | var coordinates []pos 386 | 387 | for x := 0; x < 500; x++ { 388 | for y := 0; y < 500; y++ { 389 | coordinates = append(coordinates, pos{x, y}) 390 | } 391 | } 392 | 393 | rand.Shuffle(len(coordinates), func(i, j int) { 394 | coordinates[i], coordinates[j] = coordinates[j], coordinates[i] 395 | }) 396 | 397 | var nHits, nKills int 398 | 399 | for _, coord := range coordinates { 400 | res := f.Shoot(int64(coord.x), int64(coord.y)) 401 | 402 | switch res { 403 | case field.Hit: 404 | nHits++ 405 | case field.Kill: 406 | nKills++ 407 | } 408 | } 409 | 410 | nExpectedKills := int(conf.Sizes[0] + conf.Sizes[1] + conf.Sizes[2] + conf.Sizes[3]) 411 | assert.Equal(t, nExpectedKills, nKills) 412 | 413 | nExpectedHits := int(conf.Sizes[1] + 2*conf.Sizes[2] + 3*conf.Sizes[3]) 414 | assert.Equal(t, nExpectedHits, nHits) 415 | }) 416 | 417 | // Dense field is a such field, that moving any ship 418 | // anywhere but its original position makes it invalid. 419 | t.Run("Load_Dense", func(t *testing.T) { 420 | conf := field.Configuration{ 421 | W: 10, 422 | H: 10, 423 | Sizes: [4]int64{2, 8, 3, 4}, 424 | } 425 | shipsOriginal := slices.Collect(field.ParseShips(bytes.NewReader(txtDenseField))) 426 | 427 | { 428 | f := newField() 429 | require.NoError(t, f.Load(conf, slices.Values(shipsOriginal)), "original field should load") 430 | } 431 | 432 | for i, ship := range shipsOriginal { 433 | var displaced []field.Ship 434 | displaced = append(displaced, shipsOriginal...) 435 | 436 | var maxX, maxY int64 437 | if ship.IsVert { 438 | maxX = 10 439 | maxY = 10 - int64(ship.Size) + 1 440 | } else { 441 | maxX = 10 - int64(ship.Size) + 1 442 | maxY = 10 443 | } 444 | 445 | for x := int64(0); x < maxX; x++ { 446 | for y := int64(0); y < maxY; y++ { 447 | if ship.X == int64(x) && ship.Y == int64(y) { 448 | continue 449 | } 450 | 451 | displaced[i].X = x 452 | displaced[i].Y = y 453 | 454 | f := newField() 455 | assert.Error(t, f.Load(conf, slices.Values(displaced)), "displaced field should not load") 456 | } 457 | } 458 | } 459 | }) 460 | } 461 | 462 | func TestShipField(t *testing.T) { 463 | RunFieldTests(t, func() field.Field { 464 | return field.NewShipField(0) 465 | }) 466 | } 467 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= 3 | cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= 4 | cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= 5 | cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= 6 | github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= 7 | github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= 8 | github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA= 9 | github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0/go.mod h1:OahwfttHWG6eJ0clwcfBAHoDI6X/LV/15hx/wlMZSrU= 10 | github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= 11 | github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= 12 | github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= 13 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 14 | github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= 15 | github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= 16 | github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= 17 | github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= 18 | github.com/Microsoft/hcsshim v0.12.8 h1:BtDWYlFMcWhorrvSSo2M7z0csPdw6t7no/C3FsSvqiI= 19 | github.com/Microsoft/hcsshim v0.12.8/go.mod h1:cibQ4BqhJ32FXDwPdQhKhwrwophnh3FuT4nwQZF907w= 20 | github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= 21 | github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs= 22 | github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= 23 | github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= 24 | github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= 25 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= 26 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= 27 | github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 h1:aM1rlcoLz8y5B2r4tTLMiVTrMtpfY0O8EScKJxaSaEc= 28 | github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA= 29 | github.com/beorn7/perks v0.0.0-20150223135152-b965b613227f/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= 30 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= 31 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= 32 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 33 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 34 | github.com/bitly/go-hostpool v0.1.0/go.mod h1:4gOCgp6+NZnVqlKyZ/iBZFTAJKembaVENUpMkpg42fw= 35 | github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= 36 | github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= 37 | github.com/bugsnag/bugsnag-go v1.0.5-0.20150529004307-13fd6b8acda0 h1:s7+5BfS4WFJoVF9pnB8kBk03S7pZXRdKamnV0FOl5Sc= 38 | github.com/bugsnag/bugsnag-go v1.0.5-0.20150529004307-13fd6b8acda0/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= 39 | github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b h1:otBG+dV+YK+Soembjv71DPz3uX/V/6MMlSyD9JBQ6kQ= 40 | github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= 41 | github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXer/kZD8Ri1aaunCxIEsOst1BVJswV0o= 42 | github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= 43 | github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= 44 | github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= 45 | github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= 46 | github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= 47 | github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= 48 | github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= 49 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 50 | github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= 51 | github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 52 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 53 | github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004 h1:lkAMpLVBDaj17e85keuznYcH5rqI438v41pKcBl4ZxQ= 54 | github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= 55 | github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= 56 | github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= 57 | github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= 58 | github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= 59 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 60 | github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b h1:ga8SEFjZ60pxLcmhnThWgvH2wg8376yUJmPhEH4H3kw= 61 | github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= 62 | github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE= 63 | github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4= 64 | github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0= 65 | github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0= 66 | github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= 67 | github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= 68 | github.com/containerd/containerd v1.7.24 h1:zxszGrGjrra1yYJW/6rhm9cJ1ZQ8rkKBR48brqsa7nA= 69 | github.com/containerd/containerd v1.7.24/go.mod h1:7QUzfURqZWCZV7RLNEn1XjUCQLEf0bkaK4GjUaZehxw= 70 | github.com/containerd/containerd/api v1.7.19 h1:VWbJL+8Ap4Ju2mx9c9qS1uFSB1OVYr5JJrW2yT5vFoA= 71 | github.com/containerd/containerd/api v1.7.19/go.mod h1:fwGavl3LNwAV5ilJ0sbrABL44AQxmNjDRcwheXDb6Ig= 72 | github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4= 73 | github.com/containerd/continuity v0.4.5/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= 74 | github.com/containerd/errdefs v0.3.0 h1:FSZgGOeK4yuT/+DnF07/Olde/q4KBoMsaamhXxIMDp4= 75 | github.com/containerd/errdefs v0.3.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= 76 | github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= 77 | github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= 78 | github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= 79 | github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= 80 | github.com/containerd/nydus-snapshotter v0.14.0 h1:6/eAi6d7MjaeLLuMO8Udfe5GVsDudmrDNO4SGETMBco= 81 | github.com/containerd/nydus-snapshotter v0.14.0/go.mod h1:TT4jv2SnIDxEBu4H2YOvWQHPOap031ydTaHTuvc5VQk= 82 | github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= 83 | github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= 84 | github.com/containerd/stargz-snapshotter/estargz v0.15.1 h1:eXJjw9RbkLFgioVaTG+G/ZW/0kEe2oEKCdS/ZxIyoCU= 85 | github.com/containerd/stargz-snapshotter/estargz v0.15.1/go.mod h1:gr2RNwukQ/S9Nv33Lt6UC7xEx58C+LHRdoqbEKjz1Kk= 86 | github.com/containerd/ttrpc v1.2.5 h1:IFckT1EFQoFBMG4c3sMdT8EP3/aKfumK1msY+Ze4oLU= 87 | github.com/containerd/ttrpc v1.2.5/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o= 88 | github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40= 89 | github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk= 90 | github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 91 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 92 | github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0= 93 | github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= 94 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 95 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 96 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 97 | github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= 98 | github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= 99 | github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= 100 | github.com/docker/buildx v0.19.2 h1:2zXzgP2liQKgQ5BiOqMc+wz7hfWgAIMWw5MR6QDG++I= 101 | github.com/docker/buildx v0.19.2/go.mod h1:k4WP+XmGRYL0a7l4RZAI2TqpwhuAuSQ5U/rosRgFmAA= 102 | github.com/docker/cli v27.4.0-rc.2+incompatible h1:A0GZwegDlt2wdt3tpmrUzkVOZmbhvd7i05wPSf7Oo74= 103 | github.com/docker/cli v27.4.0-rc.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= 104 | github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= 105 | github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= 106 | github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= 107 | github.com/docker/docker v27.4.0+incompatible h1:I9z7sQ5qyzO0BfAb9IMOawRkAGxhYsidKiTMcm0DU+A= 108 | github.com/docker/docker v27.4.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= 109 | github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo= 110 | github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= 111 | github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= 112 | github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c/go.mod h1:CADgU4DSXK5QUlFslkQu2yW2TKzFZcXq/leZfM0UH5Q= 113 | github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= 114 | github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= 115 | github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= 116 | github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c h1:+pKlWGMw7gf6bQ+oDZB4KHQFypsfjYlq/C4rfL7D3g8= 117 | github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= 118 | github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= 119 | github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8= 120 | github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= 121 | github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= 122 | github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= 123 | github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4= 124 | github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= 125 | github.com/dolthub/maphash v0.1.0 h1:bsQ7JsF4FkkWyrP3oCnFJgrCUAFbFf3kOl4L/QxPDyQ= 126 | github.com/dolthub/maphash v0.1.0/go.mod h1:gkg4Ch4CdCDu5h6PMriVLawB7koZ+5ijb9puGMV50a4= 127 | github.com/dolthub/swiss v0.2.1 h1:gs2osYs5SJkAaH5/ggVJqXQxRXtWshF6uE0lgR/Y3Gw= 128 | github.com/dolthub/swiss v0.2.1/go.mod h1:8AhKZZ1HK7g18j7v7k6c5cYIGEZJcPn0ARsai8cUrh0= 129 | github.com/dvsekhvalnov/jose2go v0.0.0-20170216131308-f21a8cedbbae/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= 130 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 131 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 132 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 133 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 134 | github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= 135 | github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= 136 | github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= 137 | github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= 138 | github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= 139 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 140 | github.com/fvbommel/sortorder v1.0.1 h1:dSnXLt4mJYH25uDDGa3biZNQsozaUWDSWeKJ0qqFfzE= 141 | github.com/fvbommel/sortorder v1.0.1/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= 142 | github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= 143 | github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= 144 | github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= 145 | github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= 146 | github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= 147 | github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= 148 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= 149 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= 150 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= 151 | github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 152 | github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= 153 | github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 154 | github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 155 | github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 156 | github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= 157 | github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= 158 | github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= 159 | github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= 160 | github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= 161 | github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= 162 | github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= 163 | github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= 164 | github.com/go-sql-driver/mysql v1.3.0 h1:pgwjLi/dvffoP9aabwkT3AKpXQM93QARkjFhDDqC1UE= 165 | github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= 166 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= 167 | github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= 168 | github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= 169 | github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= 170 | github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= 171 | github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 172 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= 173 | github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 174 | github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 175 | github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= 176 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 177 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 178 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= 179 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 180 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 181 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 182 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 183 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 184 | github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 185 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 186 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 187 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 188 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 189 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 190 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 191 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 192 | github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= 193 | github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 194 | github.com/google/certificate-transparency-go v1.0.10-0.20180222191210-5ab67e519c93 h1:jc2UWq7CbdszqeH6qu1ougXMIUBfSy8Pbh/anURYbGI= 195 | github.com/google/certificate-transparency-go v1.0.10-0.20180222191210-5ab67e519c93/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= 196 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 197 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 198 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 199 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 200 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 201 | github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 202 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 203 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 204 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 205 | github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= 206 | github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= 207 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 208 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 209 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 210 | github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= 211 | github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= 212 | github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= 213 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= 214 | github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= 215 | github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= 216 | github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= 217 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 218 | github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= 219 | github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 220 | github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= 221 | github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= 222 | github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 223 | github.com/in-toto/in-toto-golang v0.5.0 h1:hb8bgwr0M2hGdDsLjkJ3ZqJ8JFLL/tgYdAxF/XEFBbY= 224 | github.com/in-toto/in-toto-golang v0.5.0/go.mod h1:/Rq0IZHLV7Ku5gielPT4wPHJfH1GdHMCq8+WPxw8/BE= 225 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 226 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 227 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 228 | github.com/jinzhu/gorm v0.0.0-20170222002820-5409931a1bb8 h1:CZkYfurY6KGhVtlalI4QwQ6T0Cu6iuY3e0x5RLu96WE= 229 | github.com/jinzhu/gorm v0.0.0-20170222002820-5409931a1bb8/go.mod h1:Vla75njaFJ8clLU1W44h34PjIkijhjHIYnZxMqCdxqo= 230 | github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d h1:jRQLvyVGL+iVtDElaEIDdKwpPqUIZJfzkNLV34htpEc= 231 | github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= 232 | github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= 233 | github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= 234 | github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= 235 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= 236 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 237 | github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= 238 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= 239 | github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= 240 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 241 | github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= 242 | github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 243 | github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= 244 | github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= 245 | github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= 246 | github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= 247 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 248 | github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 249 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= 250 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 251 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 252 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 253 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 254 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 255 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 256 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 257 | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 258 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 259 | github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= 260 | github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= 261 | github.com/lib/pq v0.0.0-20150723085316-0dad96c0b94f/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= 262 | github.com/magiconair/properties v1.5.3 h1:C8fxWnhYyME3n0klPOhVM7PtYUB3eV1W3DeFmN3j53Y= 263 | github.com/magiconair/properties v1.5.3/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= 264 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 265 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 266 | github.com/mattn/go-sqlite3 v1.6.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= 267 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= 268 | github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= 269 | github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= 270 | github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= 271 | github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= 272 | github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= 273 | github.com/mitchellh/mapstructure v0.0.0-20150613213606-2caf8efc9366/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 274 | github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= 275 | github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 276 | github.com/moby/buildkit v0.18.1 h1:Iwrz2F/Za2Gjkpwu3aM2LX92AFfJCJe2oNnvGNvh2Rc= 277 | github.com/moby/buildkit v0.18.1/go.mod h1:vCR5CX8NGsPTthTg681+9kdmfvkvqJBXEv71GZe5msU= 278 | github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= 279 | github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= 280 | github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= 281 | github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= 282 | github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= 283 | github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= 284 | github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg= 285 | github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4= 286 | github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= 287 | github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= 288 | github.com/moby/sys/signal v0.7.1 h1:PrQxdvxcGijdo6UXXo/lU/TvHUWyPhj7UOpSo8tuvk0= 289 | github.com/moby/sys/signal v0.7.1/go.mod h1:Se1VGehYokAkrSQwL4tDzHvETwUZlnY7S5XtQ50mQp8= 290 | github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= 291 | github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= 292 | github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= 293 | github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= 294 | github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= 295 | github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= 296 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 297 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 298 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 299 | github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 300 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 301 | github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 302 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 303 | github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= 304 | github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= 305 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= 306 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= 307 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 308 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= 309 | github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= 310 | github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= 311 | github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= 312 | github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= 313 | github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= 314 | github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= 315 | github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= 316 | github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= 317 | github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= 318 | github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= 319 | github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= 320 | github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= 321 | github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= 322 | github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec= 323 | github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= 324 | github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= 325 | github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= 326 | github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= 327 | github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= 328 | github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= 329 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 330 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 331 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 332 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 333 | github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= 334 | github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= 335 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 336 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 337 | github.com/prometheus/client_golang v0.9.0-pre1.0.20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= 338 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= 339 | github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= 340 | github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= 341 | github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= 342 | github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 343 | github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= 344 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= 345 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 346 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 347 | github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= 348 | github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= 349 | github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= 350 | github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= 351 | github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= 352 | github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= 353 | github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= 354 | github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= 355 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= 356 | github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= 357 | github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= 358 | github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= 359 | github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= 360 | github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= 361 | github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= 362 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 363 | github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE= 364 | github.com/secure-systems-lab/go-securesystemslib v0.4.0/go.mod h1:FGBZgq2tXWICsxWQW1msNf49F0Pf2Op5Htayx335Qbs= 365 | github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh5dkI= 366 | github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE= 367 | github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= 368 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= 369 | github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= 370 | github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= 371 | github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 372 | github.com/spdx/tools-golang v0.5.3 h1:ialnHeEYUC4+hkm5vJm4qz2x+oEJbS0mAMFrNXdQraY= 373 | github.com/spdx/tools-golang v0.5.3/go.mod h1:/ETOahiAo96Ob0/RAIBmFZw6XN0yTnyr/uFZm2NTMhI= 374 | github.com/spf13/cast v0.0.0-20150508191742-4d07383ffe94 h1:JmfC365KywYwHB946TTiQWEb8kqPY+pybPLoGE9GgVk= 375 | github.com/spf13/cast v0.0.0-20150508191742-4d07383ffe94/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= 376 | github.com/spf13/cobra v0.0.1/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= 377 | github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= 378 | github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= 379 | github.com/spf13/jwalterweatherman v0.0.0-20141219030609-3d60171a6431 h1:XTHrT015sxHyJ5FnQ0AeemSspZWaDq7DoTRW0EVsDCE= 380 | github.com/spf13/jwalterweatherman v0.0.0-20141219030609-3d60171a6431/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= 381 | github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 382 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 383 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 384 | github.com/spf13/viper v0.0.0-20150530192845-be5ff3e4840c h1:2EejZtjFjKJGk71ANb+wtFK5EjUzUkEM3R0xnp559xg= 385 | github.com/spf13/viper v0.0.0-20150530192845-be5ff3e4840c/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= 386 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 387 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 388 | github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= 389 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 390 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 391 | github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= 392 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 393 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 394 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 395 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 396 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 397 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 398 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 399 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 400 | github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 401 | github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 402 | github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= 403 | github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 404 | github.com/theupdateframework/notary v0.7.0 h1:QyagRZ7wlSpjT5N2qQAh/pN+DVqgekv4DzbAiAiEL3c= 405 | github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw= 406 | github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205 h1:eUk79E1w8yMtXeHSzjKorxuC8qJOnyXQnLaJehxpJaI= 407 | github.com/tonistiigi/dchapes-mode v0.0.0-20241001053921-ca0759fec205/go.mod h1:3Iuxbr0P7D3zUzBMAZB+ois3h/et0shEz0qApgHYGpY= 408 | github.com/tonistiigi/fsutil v0.0.0-20241121093142-31cf1f437184 h1:RgyoSI38Y36zjQaszel/0RAcIehAnjA1B0RiUV9SDO4= 409 | github.com/tonistiigi/fsutil v0.0.0-20241121093142-31cf1f437184/go.mod h1:Dl/9oEjK7IqnjAm21Okx/XIxUCFJzvh+XdVHUlBwXTw= 410 | github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 h1:7I5c2Ig/5FgqkYOh/N87NzoyI9U15qUPXhDD8uCupv8= 411 | github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4/go.mod h1:278M4p8WsNh3n4a1eqiFcV2FGk7wE5fwUpUom9mK9lE= 412 | github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0= 413 | github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk= 414 | github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab h1:H6aJ0yKQ0gF49Qb2z5hI1UHxSQt4JMyxebFR15KnApw= 415 | github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc= 416 | github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= 417 | github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= 418 | github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= 419 | github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= 420 | github.com/vbatts/tar-split v0.11.6 h1:4SjTW5+PU11n6fZenf2IPoV8/tz3AaYHMWjf23envGs= 421 | github.com/vbatts/tar-split v0.11.6/go.mod h1:dqKNtesIOr2j2Qv3W/cHjnvk9I8+G7oAkFDFN6TCBEI= 422 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 423 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 424 | go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= 425 | go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= 426 | go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= 427 | go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= 428 | go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 h1:gbhw/u49SS3gkPWiYweQNJGm/uJN5GkI/FrosxSHT7A= 429 | go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1/go.mod h1:GnOaBaFQ2we3b9AGWJpsBa7v1S5RlQzlC3O7dRMxZhM= 430 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 h1:DheMAlT6POBP+gh8RUH19EOTnQIor5QE0uSRPtzCpSw= 431 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0/go.mod h1:wZcGmeVO9nzP67aYSLDqXNWK87EZWhi7JWj1v7ZXf94= 432 | go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= 433 | go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= 434 | go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 h1:jd0+5t/YynESZqsSyPz+7PAFdEop0dlN0+PkyHYo8oI= 435 | go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0/go.mod h1:U707O40ee1FpQGyhvqnzmCJm1Wh6OX6GGBVn0E6Uyyk= 436 | go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= 437 | go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= 438 | go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6ZXmNPRR8ul6i3WgFURCHzaXjHdm0karRG/+dj3s= 439 | go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= 440 | go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03ymgYhPKmeXGk5Zu+cIZOlVzd9Zv7QIiyItjFBU= 441 | go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk= 442 | go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= 443 | go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= 444 | go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= 445 | go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= 446 | go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= 447 | go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= 448 | go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= 449 | go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= 450 | go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= 451 | go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= 452 | go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= 453 | go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= 454 | golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= 455 | golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= 456 | golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= 457 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 458 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 459 | golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 460 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 461 | golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 462 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 463 | golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= 464 | golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= 465 | golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= 466 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 467 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 468 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 469 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 470 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 471 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 472 | golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= 473 | golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 474 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 475 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 476 | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 477 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 478 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 479 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 480 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 481 | golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 482 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 483 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 484 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 485 | golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 486 | golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= 487 | golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= 488 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 489 | golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= 490 | golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= 491 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 492 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 493 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 494 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 495 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 496 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 497 | golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= 498 | golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 499 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 500 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 501 | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 502 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 503 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 504 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 505 | golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 506 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 507 | golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 508 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 509 | golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 510 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 511 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 512 | golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 513 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 514 | golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= 515 | golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 516 | golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= 517 | golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= 518 | golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= 519 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 520 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 521 | golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= 522 | golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 523 | golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= 524 | golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 525 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 526 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 527 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 528 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 529 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 530 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 531 | golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 532 | golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 533 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 534 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 535 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 536 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 537 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 538 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 539 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 540 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 541 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 542 | google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ= 543 | google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= 544 | google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= 545 | google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= 546 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= 547 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= 548 | google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= 549 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 550 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 551 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 552 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 553 | google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= 554 | google.golang.org/grpc v1.66.3 h1:TWlsh8Mv0QI/1sIbs1W36lqRclxrmF+eFJ4DbI0fuhA= 555 | google.golang.org/grpc v1.66.3/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 556 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 557 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 558 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 559 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 560 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 561 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 562 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 563 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 564 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 565 | google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= 566 | google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 567 | gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= 568 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 569 | gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII= 570 | gopkg.in/cenkalti/backoff.v2 v2.2.1/go.mod h1:S0QdOvT2AlerfSBkp0O+dk+bbIMaNbEmVk876gPCthU= 571 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 572 | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 573 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 574 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 575 | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= 576 | gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= 577 | gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.1 h1:d4KQkxAaAiRY2h5Zqis161Pv91A37uZyJOx73duwUwM= 578 | gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.1/go.mod h1:WbjuEoo1oadwzQ4apSDU+JTvmllEHtsNHS6y7vFc7iw= 579 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 580 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 581 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 582 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 583 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 584 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 585 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 586 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 587 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 588 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 589 | gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= 590 | gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= 591 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 592 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 593 | nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= 594 | rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= 595 | --------------------------------------------------------------------------------