Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 27 additions & 34 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,38 @@ on:
jobs:

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go_version: [ '1.17', '1.18' ]
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
include:
- os: ubuntu-latest
services:
proxy:
image: abhinavsingh/proxy.py:v2.4.4
ports:
- "8899:8899"
target:
image: nginx:1.23.2
ports:
- "80:80"
env:
PROXY_URL: 'http://localhost:8899'
TARGET_URL: 'http://target:80'
- os: windows-latest
services: {}
env: {}
- os: macOS-latest
services: {}
env: {}

services: ${{ matrix.services }}
runs-on: ${{ matrix.os }}
go: [ '1.25', '1.26' ]
services:
proxy:
image: abhinavsingh/proxy.py:v2.4.4
ports:
- "8899:8899"
target:
image: nginx:1.23.2
ports:
- "80:80"
env:
PROXY_URL: 'http://localhost:8899'
TARGET_URL: 'http://target:80'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use GO ${{ matrix.go_version }}
uses: actions/setup-go@v2
- name: Use Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}
go-version: ${{ matrix.go }}

- name: Test GO ${{ matrix.go_version }}
- name: Test
run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic
env: ${{ matrix.env }}

- name: Upload to codecov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.go_version == '1.17' }}
run: bash <(curl -s https://codecov.io/bash)
- name: Upload coverage to Codecov
if: ${{ matrix.go == '1.26' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
fail_ci_if_error: false
35 changes: 12 additions & 23 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
name: golangci-lint

on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- master
- main
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
strategy:
matrix:
go_version: [ '1.17', '1.18' ]
os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
name: lint
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
go-version: '1.26'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v7
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.42.1
# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
version: v2.12.2
4 changes: 3 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package proxycheck
import "errors"

var (
// FeedEnd this error happens when the feed runs out of proxies to check
// FeedEnd this error happens when the feed runs out of proxies to check.
// Named without the conventional Err* prefix to preserve the public API.
//nolint:staticcheck // ST1012: renaming would break importers of the package
FeedEnd = errors.New("feed end")
)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/memclutter/proxycheck

go 1.18
go 1.25

require (
github.com/urfave/cli/v2 v2.23.4
Expand Down
6 changes: 3 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
"h12.io/socks"
"io/ioutil"
"io"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -55,6 +55,6 @@ func createProxyTransport(proxyURL *url.URL, timeout time.Duration) *http.Transp
}

func readResponse(httpResponse *http.Response) ([]byte, error) {
defer httpResponse.Body.Close()
return ioutil.ReadAll(httpResponse.Body)
defer func() { _ = httpResponse.Body.Close() }()
return io.ReadAll(httpResponse.Body)
}
Loading