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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.23.6' ]
go: [ '1.26' ]
steps:
- uses: actions/checkout@v3

Expand Down
216 changes: 37 additions & 179 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,201 +1,61 @@
version: "2"

run:
go: "1.23.6"
concurrency: 4
go: "1.26"
timeout: 5m
tests: false
issues-exit-code: 1
modules-download-mode: readonly
allow-parallel-runners: true

issues:
exclude-use-default: false
max-issues-per-linter: 100
max-same-issues: 4
max-issues-per-linter: 0
max-same-issues: 0
new: false
exclude-files:
- ".+_test.go"
exclude-dirs:
- "vendor$"
fix: false

output:
formats:
- format: line-number
sort-results: true
text:
print-linter-name: true
print-issued-lines: true

linters-settings:
govet:
check-shadowing: true
enable:
- asmdecl
- assign
- atomic
- atomicalign
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- errorsas
- findcall
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shadow
- shift
- sigchanyzer
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
- unusedwrite
disable:
- fieldalignment
gofmt:
simplify: true
errcheck:
check-type-assertions: true
check-blank: true
gocyclo:
min-complexity: 30
misspell:
locale: US
prealloc:
simple: true
range-loops: true
for-loops: true
unparam:
check-exported: false
gci:
skip-generated: true
custom-order: false
gosec:
includes:
- G101 # Look for hard coded credentials
- G102 # Bind to all interfaces
- G103 # Audit the use of unsafe block
- G104 # Audit errors not checked
- G106 # Audit the use of ssh.InsecureIgnoreHostKey
- G107 # Url provided to HTTP request as taint input
- G108 # Profiling endpoint automatically exposed on /debug/pprof
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
- G110 # Potential DoS vulnerability via decompression bomb
- G111 # Potential directory traversal
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
- G204 # Audit use of command execution
- G301 # Poor file permissions used when creating a directory
- G302 # Poor file permissions used with chmod
- G303 # Creating tempfile using a predictable path
- G304 # File path provided as taint input
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Deferring a method which returns an error
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
excludes:
- G101 # Look for hard coded credentials
- G102 # Bind to all interfaces
- G103 # Audit the use of unsafe block
- G104 # Audit errors not checked
- G106 # Audit the use of ssh.InsecureIgnoreHostKey
- G107 # Url provided to HTTP request as taint input
- G108 # Profiling endpoint automatically exposed on /debug/pprof
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
- G110 # Potential DoS vulnerability via decompression bomb
- G111 # Potential directory traversal
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
- G204 # Audit use of command execution
- G301 # Poor file permissions used when creating a directory
- G302 # Poor file permissions used with chmod
- G303 # Creating tempfile using a predictable path
- G304 # File path provided as taint input
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Deferring a method which returns an error
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
exclude-generated: true
severity: medium
confidence: medium
concurrency: 12
config:
global:
nosec: true
"#nosec": "#my-custom-nosec"
show-ignored: true
audit: true
G101:
pattern: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
ignore_entropy: false
entropy_threshold: "80.0"
per_char_threshold: "3.0"
truncate: "32"
G104:
fmt:
- Fscanf
G111:
pattern: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)"
G301: "0750"
G302: "0600"
G306: "0600"

lll:
line-length: 130
tab-width: 1
staticcheck:
go: "1.15"
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"]
checks: [ "*", "-SA1019" ]
formatters:
exclusions:
paths:
- vendors/
enable:
- gofmt
- goimports

linters:
disable-all: true
settings:
staticcheck:
checks:
- all
- -S1023
- -ST1000
- -ST1003
- -ST1020
gosec:
excludes:
- G104
- G115
- G301
- G304
- G306
- G501
- G505
exclusions:
paths:
- vendors/
default: none
enable:
- govet
- gofmt
- errcheck
- misspell
- gocyclo
- ineffassign
- goimports
- unparam
- unused
- prealloc
Expand All @@ -206,5 +66,3 @@ linters:
- errorlint
- bodyclose
- gosec
- lll
fast: false
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2024-2025, Mikhail Knyazhev <markus621@yandex.ru>
Copyright (c) 2024-2026, Mikhail Knyazhev <markus621@yandex.ru>

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL=/bin/bash

.PHONY: install
install:
go install go.osspkg.com/goppy/v2/cmd/goppy@latest
go install go.osspkg.com/goppy/v3/cmd/goppy@latest
goppy setup-lib

.PHONY: lint
Expand Down
2 changes: 1 addition & 1 deletion address/common.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Copyright (c) 2024-2026 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
*/

Expand Down
2 changes: 1 addition & 1 deletion address/common_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Copyright (c) 2024-2026 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
*/

Expand Down
2 changes: 1 addition & 1 deletion client/adapter.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Copyright (c) 2024-2026 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
*/

Expand Down
12 changes: 6 additions & 6 deletions client/client.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Copyright (c) 2024-2026 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
*/

Expand All @@ -13,8 +13,8 @@ import (
"net"

"github.com/quic-go/quic-go"
"go.osspkg.com/algorithms/control"
"go.osspkg.com/errors"
"go.osspkg.com/syncing"

"go.osspkg.com/network/internal"
)
Expand All @@ -27,7 +27,7 @@ type (
_client struct {
conf Config
tls *tls.Config
sem control.Semaphore
sem syncing.Control
}
)

Expand All @@ -50,7 +50,7 @@ func New(c Config) (Client, error) {

cli := &_client{
conf: c,
sem: control.NewSemaphore(c.MaxConns),
sem: syncing.NewControl(c.MaxConns),
tls: tlsc,
}

Expand Down Expand Up @@ -98,15 +98,15 @@ func (v *_client) conn(ctx context.Context) (internal.Conn, error) {
}

func (v *_client) Call(ctx context.Context, handler func(ctx context.Context, w io.Writer, r io.Reader) error) (e error) {
v.sem.Acquire()
v.sem.Acquire(ctx)
defer func() { v.sem.Release() }()

conn, err := v.conn(ctx)
if err != nil {
return err
}

stop := internal.DeadlineUpdate(conn)
stop := internal.AutoUpdateDeadline(conn, 0)

defer func() {
stop()
Expand Down
2 changes: 1 addition & 1 deletion client/config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Copyright (c) 2024-2026 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
*/

Expand Down
10 changes: 5 additions & 5 deletions client/tls.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Copyright (c) 2024-2026 Mikhail Knyazhev <markus621@yandex.ru>. All rights reserved.
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
*/

Expand All @@ -15,10 +15,10 @@ import (
)

type Certificate struct {
CAFile string `yaml:"ca_file"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
CAFile string `yaml:"ca_file,omitempty" unic:"ca_file,omitempty,desc='Адрес корневого сертификата'"`
CertFile string `yaml:"cert_file,omitempty" unic:"cert_file,omitempty,desc='Адрес публичного сертификата'"`
KeyFile string `yaml:"key_file,omitempty" unic:"key_file,omitempty,desc='Адрес приватного ключа'"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify,omitempty" unic:"insecure_skip_verify,omitempty,default='false',desc='Пропускать проверку корневых сертификатов'"`
}

func (c *Certificate) parse() (cert tls.Certificate, ca *x509.CertPool, err error) {
Expand Down
Loading
Loading