Skip to content
Open
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
28 changes: 24 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# This file is licensed under the terms of the MIT license https://opensource.org/license/mit
# Copyright (c) 2021-2025 Marat Reymers
# Copyright (c) 2021-2025 Marat Reimers

## Golden config for golangci-lint v2.5.0
## Golden config for golangci-lint v2.9.0
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adapt it to suit your needs.
# If this config helps you, please consider keeping a link to this file (see the next comment).
# If this config helps you, please consider keeping a link to this repo (see the next comment).

# Based on https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
# Based on https://github.com/maratori/golangci-lint-config

version: "2"

Expand Down Expand Up @@ -82,6 +82,7 @@ linters:
- makezero # finds slice declarations with non-zero initial length
- mirror # reports wrong mirror patterns of bytes/strings usage
- mnd # detects magic numbers
- modernize # suggests simplifications to Go code, using modern language and library features
- musttag # enforces field tags in (un)marshaled structs
- nakedret # finds naked returns in functions greater than a specified function length
- nestif # reports deeply nested if statements
Expand Down Expand Up @@ -256,10 +257,15 @@ linters:
- ^firebase.google.com/go/v4/messaging.Message$
- ^github.com/aws/aws-sdk-go-v2/service/s3.+Input$
- ^github.com/aws/aws-sdk-go-v2/service/s3/types.ObjectIdentifier$
- ^github.com/go-telegram-bot-api/telegram-bot-api/.+Config$
- ^github.com/go-telegram/bot.+Params$
- ^github.com/go-telegram/bot/models.+$
- ^github.com/gofiber/.+Config$
- ^github.com/golang-jwt/jwt/v5.+Claims$
- ^github.com/mitchellh/mapstructure.DecoderConfig$
- ^github.com/mymmrac/telego.+Parameters$
- ^github.com/prometheus/client_golang/.+Opts$
- ^github.com/revrost/go-openrouter.+$
- ^github.com/secsy/goftp.Config$
- ^github.com/Shopify/sarama.Config$
- ^github.com/Shopify/sarama.ProducerMessage$
Expand All @@ -268,6 +274,7 @@ linters:
- ^github.com/stretchr/testify/mock.Mock$
- ^github.com/testcontainers/testcontainers-go.+Request$
- ^github.com/testcontainers/testcontainers-go.FromDockerfile$
- ^github.com/ThreeDotsLabs/watermill.+(Config|Schema|Adapter)$
- ^github.com/urfave/cli.v3.ArgumentBase$
- ^github.com/urfave/cli.v3.Command$
- ^github.com/urfave/cli.v3.FlagBase$
Expand Down Expand Up @@ -328,6 +335,16 @@ linters:
# Assert no unused link in godocs.
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#no-unused-link
- no-unused-link
# Require proper doc links to standard library declarations where applicable.
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#require-stdlib-doclink
- require-stdlib-doclink

gosec:
# To specify a set of rules to explicitly exclude.
# Available rules: https://github.com/securego/gosec#available-rules
excludes:
- G117 # Potential exposure of secrets via JSON marshaling
- G704 # SSRF via taint analysis

govet:
# Enable all analyzers.
Expand Down Expand Up @@ -376,6 +393,9 @@ linters:
max-func-lines: 0

nolintlint:
# Disable to ensure that all nolint directives actually have an effect.
# Default: false
allow-unused: true
# Exclude following linters from requiring an explanation.
# Default: []
allow-no-explanation: [funlen, gocognit, golines]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.24.3

require (
firebase.google.com/go/v4 v4.12.1
github.com/android-sms-gateway/client-go v1.9.6-0.20251123133512-f7816d96f90a
github.com/android-sms-gateway/client-go v1.10.1
github.com/ansrivas/fiberprometheus/v2 v2.6.1
github.com/capcom6/go-helpers v0.3.0
github.com/capcom6/go-infra-fx v0.5.2
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/android-sms-gateway/client-go v1.9.6-0.20251123133512-f7816d96f90a h1:Tm1FDTqFRs1ZftaEmQqDdIXtMRZf2aGCp8t2BgXY/rs=
github.com/android-sms-gateway/client-go v1.9.6-0.20251123133512-f7816d96f90a/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/android-sms-gateway/client-go v1.10.1-0.20260217004820-83d276545735 h1:/dwS503F7TbfkmKoEWHVb1FHZMzdX5fUUEyQgRiojXU=
github.com/android-sms-gateway/client-go v1.10.1-0.20260217004820-83d276545735/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/android-sms-gateway/client-go v1.10.1-0.20260218044357-fb0b167fbe22 h1:egrBOdjsn7onxrbFQwZ0wptDgN/5xO6nsfSIlraB7RU=
github.com/android-sms-gateway/client-go v1.10.1-0.20260218044357-fb0b167fbe22/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/android-sms-gateway/client-go v1.10.1 h1:8Sby6DRp5CEVpTSeZDvi9r1ooMK21Vf1lZkeu7absVw=
github.com/android-sms-gateway/client-go v1.10.1/go.mod h1:DQsReciU1xcaVW3T5Z2bqslNdsAwCFCtghawmA6g6L4=
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM=
Expand Down
2 changes: 1 addition & 1 deletion internal/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

type Duration time.Duration

// Duration returns the underlying time.Duration value.
// Duration returns the underlying [time.Duration] value.
func (d *Duration) Duration() time.Duration {
if d == nil {
return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,11 @@ func NewBasic(usersSvc *users.Service) fiber.Handler {

// Check if the credentials are in the correct form
// which is "username:password".
index := strings.Index(creds, ":")
if index == -1 {
username, password, ok := strings.Cut(creds, ":")
if !ok {
return fiber.ErrUnauthorized
}

// Get the username and password
username := creds[:index]
password := creds[index+1:]

user, err := usersSvc.Login(c.Context(), username, password)
if err != nil {
return fiber.ErrUnauthorized
Expand Down
1 change: 1 addition & 0 deletions internal/sms-gateway/modules/metrics/handler.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:revive // ignore package name
package metrics

import (
Expand Down
1 change: 1 addition & 0 deletions internal/sms-gateway/modules/metrics/module.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:revive // ignore package name
package metrics

import (
Expand Down
6 changes: 6 additions & 0 deletions internal/sms-gateway/modules/settings/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ var (
"retry_count": "",
"signing_key": "",
},
"gateway": map[string]any{
"notification_channel": "",
},
}

rulesPublic = map[string]any{
Expand All @@ -56,6 +59,9 @@ var (
"internet_required": "",
"retry_count": "",
},
"gateway": map[string]any{
"notification_channel": "",
},
}
)

Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package version
package version //nolint:revive // ignore package name

import "strconv"

Expand Down
10 changes: 5 additions & 5 deletions test/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
public:
image: android-sms-gateway/server
image: android-sms-gateway/server:public
build:
context: ../..
dockerfile: ./build/package/Dockerfile
Expand All @@ -22,13 +22,13 @@ services:
- "3000:3000"
volumes:
- ./data/config.yml:/app/config.yml:ro
restart: 'unless-stopped'
restart: "unless-stopped"
depends_on:
db:
condition: service_healthy

private:
image: android-sms-gateway/server
image: android-sms-gateway/server:private
build:
context: ../..
dockerfile: ./build/package/Dockerfile
Expand All @@ -50,7 +50,7 @@ services:
- "3001:3000"
volumes:
- ./data/config.yml:/app/config.yml:ro
restart: 'unless-stopped'
restart: "unless-stopped"
depends_on:
db:
condition: service_healthy
Expand All @@ -62,7 +62,7 @@ services:
- MARIADB_AUTO_UPGRADE=1
volumes:
- ./data/10-init.sql:/docker-entrypoint-initdb.d/10-init.sql:ro
restart: 'unless-stopped'
restart: "unless-stopped"
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 4s
Expand Down
Loading