aboutsummaryrefslogtreecommitdiff
path: root/lib/smtp
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-01-23 03:40:50 +0700
committerShulhan <ms@kilabit.info>2025-01-23 03:41:10 +0700
commit2a0694d2fa577574b505c4635eb8a824eaf88ddc (patch)
treecce840739c7f59893c3a6a65a1600f9f857c484e /lib/smtp
parent605d847b236dde031a2e387e74298d66a27b5e0a (diff)
downloadpakakeh.go-2a0694d2fa577574b505c4635eb8a824eaf88ddc.tar.xz
all: use for-range with numeric
Go 1.22 now support for-range on numeric value.
Diffstat (limited to 'lib/smtp')
-rw-r--r--lib/smtp/account.go8
-rw-r--r--lib/smtp/smtp.go12
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/smtp/account.go b/lib/smtp/account.go
index 5a4ed48f..542ab944 100644
--- a/lib/smtp/account.go
+++ b/lib/smtp/account.go
@@ -1,6 +1,6 @@
-// Copyright 2019, Shulhan <ms@kilabit.info>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// SPDX-FileCopyrightText: 2019 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
package smtp
@@ -28,7 +28,7 @@ func NewAccount(name, local, domain, pass string) (acc *Account, err error) {
local = strings.ToLower(local)
if len(pass) > 0 {
- for x := 0; x < 3; x++ {
+ for range 3 {
hpass, err = bcrypt.GenerateFromPassword([]byte(pass), bcrypt.DefaultCost)
if err == nil {
break
diff --git a/lib/smtp/smtp.go b/lib/smtp/smtp.go
index eedbc930..f7121280 100644
--- a/lib/smtp/smtp.go
+++ b/lib/smtp/smtp.go
@@ -1,6 +1,6 @@
-// Copyright 2018, Shulhan <ms@kilabit.info>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
package smtp
@@ -186,7 +186,8 @@ func parseLocalDomain(data []byte, allow []byte) (out []byte) {
found bool
isDot bool
)
- for x := 0; x < len(data); x++ {
+ var x int
+ for ; x < len(data); x++ {
if data[x] == '(' {
x = skipComment(data, x)
if x == len(data) {
@@ -250,7 +251,8 @@ func skipComment(data []byte, x int) int {
// %d32-126.
func parseQuotedMailbox(data []byte) (out []byte) {
out = append(out, '"')
- for x := 0; x < len(data); x++ {
+ var x int
+ for ; x < len(data); x++ {
if data[x] < 32 || data[x] == 34 || data[x] > 126 {
return nil
}