| Age | Commit message (Collapse) | Author |
|
|
|
With help of spdxconv tool [1], we able to bulk update all files license
and copyright format to comply with SPDX formats.
[1] https://kilabit.info/project/spdxconv/
|
|
The "nolint" tag is used to ignore lines from being processed by
golangci-lint.
Since we are not using golangci-lint anymore, now and in the
future, those lines can be removed.
|
|
Go 1.22 now support for-range on numeric value.
|
|
Some of warnings from those linter are false positives, so we just
annotated them.
|
|
For HTTP server that use TLS, set the minimum TLS version and
ReadHeaderTimeout to mitigate slowloris attack.
For HTTP client or server that parameterize the use of InsecureSkipVerify,
annotate the line with "nolint:gosec" to allow the code pass the check.
Library that still use sha1, in example in DKIM and TOTP, skip the
warnings by annotating the line with "nolint:gosec".
A pointer variable now allocated their address before assigning its
value.
Any error that returned now wrapped using "%w".
Also, replace error checking using [errors.Is] or [errors.As] instead of
using equal or not-equal operators.
In "lib/http", replace any usage of "math/rand" with "crypto/rand".
Any call of [math/big.Rat.SetString] now annotated with "nolint:gosec"
since its false positive, the issue has been fixed in Go >= 1.17.7.
Any switch case that does not cover the rest of the possible values now
handled by adding the cases or by replacing the "default" case with
the rest of values.
|
|
HTTP request now implicitly create request with context.
Any false positive related to not closing HTTP response body has been
annotated with "nolint:bodyclose".
In the example code, use consistent "// Output:" comment format, by
prefixing with single space.
Any comment on code now also prefixing with single space.
An error returned without variables now use [errors.New] instead of
[fmt.Errorf].
Any error returned using [fmt.Errorf] now wrapped using "%w" instead of
"%s".
Also, replace error checking using [errors.Is] or [errors.As], instead
of using equal/not-equal operator.
Any statement like "x = x OP y" now replaced with "x OP= y".
Also, swap statement is simplified using "x, y = y, x".
Any switch statement with single case now replaced with if-condition.
Any call to defer on function or program that call [os.Exit], now
replaced by calling the deferred function directly.
Any if-else condition now replaced with switch statement, if possible.
|
|
Instead of annotating the lines that caught by linters, fix it to comply
with the recommendations.
This causes several breaking changes, especially related to naming,
* api/slack: [Message.IconUrl] become [Message.IconURL]
* lib/dns: DefaultSoaMinumumTtl become DefaultSoaMinimumTTL
* lib/email: [Message.SetBodyHtml] become [Message.SetBodyHTML]
* lib/http: [Client.GenerateHttpRequest] become
[Client.GenerateHTTPRequest]
* lib/http: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL]
* lib/http: [EndpointRequest.HttpWriter] become
[EndpointRequest.HTTPWriter]
* lib/http: [EndpointRequest.HttpRequest] become
[EndpointRequest.HTTPRequest]
* lib/http: [ServerOptions.EnableIndexHtml] become
[ServerOptions.EnableIndexHTML]
* lib/http: [SSEConn.HttpRequest] become [SSEConn.HTTPRequest]
* lib/smtp: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL]
* lib/ssh/sftp: [FileAttrs.SetUid] become [FileAttrs.SetUID]
* lib/ssh/sftp: [FileAttrs.Uid] become [FileAttrs.UID]
|
|
There are several reasons that why we move from github.com.
First, related to the name of package.
We accidentally name the package with "share" a common word in English
that does not reflect the content of repository.
By moving to other repository, we can rename it to better and unique
name, in this "pakakeh.go".
Pakakeh is Minang word for tools, and ".go" suffix indicate that the
repository related to Go programming language.
Second, supporting open source.
The new repository is hosted under sourcehut.org, the founder is known
to support open source, and all their services are licensed under AGPL,
unlike GitHub that are closed sources.
Third, regarding GitHub CoPilot.
The GitHub Terms of Service [1], allow any public content that are hosted
there granted them to parse the content.
On one side, GitHub helps and flourish the open source, but on another
side have an issues regarding scraping the copyleft license [2].
[1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us
[2]: https://githubcopilotinvestigation.com
|
|
There are some reports that I disagree with revive, in example, code
should not declare the type after variables.
In my opinion, on some cases, declaring the type make the code more
readable and explicit.
Since I did not want to add new configuration file, we changes it and
follow revive for now.
|
|
The passphrase parameter is optional, it will be used only if the private
key is encrypted.
|
|
Previously, the LoadPrivateKey function only able to load private key
with PKCS#1 format.
This changes make the function as a wrapper for ssh.ParseRawPrivate
that can load RSA, DSA, ECDSA, and Ed25519 in PKCS#1, PKCS#8, OpenSSL,
and OpenSSH formats.
|
|
The shadow tool [1] report a variable where its name is declared twice
or more, in different scope.
[1] https://pkg.go.dev/golang.org/x/tools@v0.13.0/go/analysis/passes/shadow
|
|
Since Go 1.20 the "math/rand.Seed" is considered deprecated (the initial
value of rand is seeded automatically, not zero).
Now, it is the time to replace "math/rand" with more secure random number
generator, from "crypto/rand".
This changes affect tests in package "lib/email", "lib/http", and
"lib/stmp".
|
|
|
|
The following rules are applied to the data,
* all lines must end with CRLF
* if the line start with period, additional period is inserted before
the line. This recommendation based on RFC 5321 section 4.5.2 to prevent
data that contains CRLF "." CRLF does not corrupt the message,
causing the server terminate reading the message where it should not.
[1] https://datatracker.ietf.org/doc/html/rfc5321#section-4.5.2
|
|
Using the TLS v1.1 is considered insecure and should not be used in
server anymore.
|
|
|
|
Somehow in 3a1a2715b25f, we include this method without implementing it.
The SendEmail method simplify sending email by automatically create
[MailTx] for passing it to method Client.MailTx.
The test right now use live connection since the Server is not ready yet.
|
|
This changes rename field,
* listener to listenMta since this is the socket that responsible
receiving message from other Mail Trasnfer Agent (MTA).
* tlsListener to listenSubmission since this is the socket that
responsible receiving message from Mail User Agent (MUA) for submiting
new message.
|
|
Even if LocalHandler and LocalStorage is one of implementation of
Handler and Storage, it is be better if its return the actual type, to
minimize confusion.
|
|
This cut the test time to 0.100 second, match with sleep duration.
|
|
Package name in test Example should be different with the actual package.
This is to minimize leaking un-exported function or method in Example
test.
|
|
Using global debug value for all packages turns out is not a good
idea.
|
|
The lib/io#Reader will be deprecated and replaced with lib/bytes#Parser
in the future.
|
|
This changes require all unit tests to use their own client.
|
|
|
|
Since Go 1.16, the ioutil package has been deprecated.
This changes replace any usage that use functions from ioutil package
with their replacement from package os or package io.
|
|
Calling Pack now set the Date header if its not exist, using the local
time; and the message-id header if its not exist using the following
format:
<epoch>.<random-8-chars>@<local-hostname>
The random-8-chars is Seed-ed from Epoch(), so does the boundary.
|
|
Previously, the MIME header is generated in the following order:
content-type: ...
mime-version: ...
content-transfer-encoding: ...
This changes reorder the mime-version to the top.
|
|
The Date field value is set to current time on the system that
generated the message.
The date format is set to "Mon, 2 Jan 2006 15:04:05 -0700" according
to RFC 5322 section 3.3.
|
|
Previously, to create new client one must pass three parameters to
NewClient function: localName, remoteURL, and insecure.
If we want to add another parameters in the future, it will cause the
function signature changes.
This changes simplify creating NewClient by passing single struct
with new parameters: AuthUser, AuthPass, and AuthMechanism.
If both AuthUser and AuthPass is not empty, the NewClient will
authenticate the connection, minimize number of step on the caller.
|
|
The following status codes are added,
* 432: StatusPasswordTransitionNeeded, from section 4.7.12.
* 454: StatusTemporaryAuthFailure, from section 4.7.0.
* 534: StatusAuthMechanismTooWeak, from section 5.7.9.
|
|
|
|
The goal is to minimize memory consumed by struct instance.
Changes,
* Client: from 112 to 80 bytes (-32 bytes)
* Command: from 48 to 32 bytes (-8 bytes)
* Domain: from 32 to 24 bytes (-8 bytes)
* LocalStorage: from 72 to 40 bytes (-32 bytes)
* MailTx: from 128 to 112 bytes (-16 bytes)
* receiver: from 152 to 104 bytes (-48 bytes)
* Response: from 32 to 24 bytes (-8 bytes)
* Server: from 144 to 128 bytes (-16 bytes)
* ServerInfo: from 40 to 32 bytes (-8 bytes)
|
|
If one read the current documentation on how to use the Client.SendTx,
there is a missing link on how to create and populate MailTx.
This changes provide the example using the email package to generate
the MailTx Data.
|
|
This is to indicate that the content of this file is a type named
MailTx.
|
|
Noop send the NOOP command to server with optional message.
On success, it will return response with Code 250, StatusOK.
While at it fix double call to recv on Reset() method.
|
|
The Reset() method send the STMP RSET command to the server.
This command clear the current buffer on MAIL, RCPT, and DATA, but not the
EHLO/HELO buffer.
On success, it will return response with Code 250, StatusOK.
|
|
|
|
This is to prevent the recv return nil on *Response without an error,
which may cause panic on caller side.
|
|
Previously, the test.Assert and test.AssertBench functions has the
boolean parameter to print the stack trace of test in case its not equal.
Since this parameter is not mandatory and its usually always set to
"true", we remove them from function signature to simplify the call
to Assert and AssertBench.
|
|
|
|
|
|
|
|
|
|
|
|
The lookup test should use local DNS server instead of relying on
external DNS response.
|
|
|
|
|