| 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.
|
|
Since Go 1.20, the standard bytes package have the Copy function.
Since Go 1.22, the standard slices package have the Concat function.
|
|
While at it, temporary disable gosec due to excessive report for G115,
which may be true, but may also break the current working program.
We should alter and fix once we can test and make sure that it does not
breaks.
|
|
By exporting the field, this allow the caller to filter or manage the
Header Fields manually.
|
|
After the header and body has been parsed, if the header contains
Content-Transfer-Encoding, we decode the body into its local formats.
Currently supported encoding is "quoted-printable" and "base64".
|
|
Although, a message from network must end with CRLF, a message from
(another) client may have been sanitized and end with LF only.
|
|
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.
|
|
According to RFC 6376,
To avoid denial-of-service attacks, implementations MAY consider any
value longer than 12 digits to be infinite.
Since ExpiredAt type is uint64, we cannot set it to infinite, so set it
to maximum value int64 (not maximum of uint64).
|
|
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 ID method return the Message-ID or empty if its not exist.
|
|
The WriteTo should return int64 not int.
|
|
|
|
|
|
|
|
The realignment reduce the cost of the following struct,
* struct in TestNewDNSClientPool: from 64 to 56 bytes (-8 bytes)
* Key: from 160 to 144 bytes (-16 bytes)
* struct in TestKeyParseTXT: from 48 to 40 bytes (-8 bytes)
* KeyPool: from 16 to 8 bytes (-8 bytes)
* Signature: from 256 to 240 bytes (-16 bytes)
* struct in TestSignatureHash: from 48 to 40 bytes (-8 bytes)
* struct in TestSignatureSign: from 80 to 64 bytes (-16 bytes)
* struct in TestSignatureVerify: from 72 to 64 bytes (-8 bytes)
* Status: from 48 to 24 bytes (-24 bytes)
* tag: from 16 to 8 bytes (-8 bytes)
|
|
On Linux, if one try to write to directory without permission its
return an error: "permission denied", while on Darwin its return
"read-only file system".
|
|
Using string provide safety, guaranteed that if we pass it as parameter
the receiver will not be able to modify its content.
|
|
The asciiset.Set type is exported as ascii.Set.
|
|
The package asciiset add new type ASCIISet, a bitmap to represent list of ASCII characters
for faster lookup.
ASCIISet is a 36-byte value, where each bit in the first 32-bytes represents the presence of
a given ASCII character in the set.
The remaining 4-bytes is a counter for the number of ASCII characters in the set.
The 128-bits of the first 16 bytes, starting with the least-significant bit of the lowest word
to the most-significant bit of the highest word, map to the full range of all 128 ASCII characters.
The 128-bits of the next 16 bytes will be zeroed, ensuring that any non-ASCII character will
be reported as not in the set.
|
|
Once the field Name has detected and its Value is valid, we can unpack
the Value based to type that it represent, for example to Date or Mailbox.
This changes remove calling to unpack directly in some tests and check
an error when testing ParseHeader.
|
|
In the obsolete syntax, white space and comments can appear between many
more element, for example the folloing Date value are valid
Date : Fri, 21 Nov 1997 09(comment): 55 : 06 -0600
This changes handle this by sanitizing the Field value, removing comment
and merge multiple spaces into one, before parsing it.
|
|
|
|
In obsolete syntax for mailbox in Field value, a domain can have space.
For example, the following message-id is valid according to RFC 5322
Section A.6.3:
message-id:<1234 @ local(blah) .machine .example>\r\n
This changes handle this by removing all spaces before validating the
domain name.
|
|
Split the parsing into two methods: parseName and parseValue.
The error returned from those methods are prefixed by its name.
|
|
The field ContentType will be set only when the field Name is
"Content-Type" so it's not always exist on each field.
To get the field ContentType, use Header.ContentType().
|
|
Add an overview of all types as building blocks from top to bottom so
we can see the relation in each of them.
|
|
The GetParamValue and SetBoundary should match any parameter key in
case insensitive matter.
While at it, add examples for ParseContentType and SetBoundary, and move
test for GetParamValue to Example.
|
|
While at it, also fix the ContentType String method to prefix ';' before
appending parameter key and value.
|
|
Since Folder and main maildir actually has the same directory structure,
except the file "maildirfolder", we can use and embed them in Manager.
This is to minimize duplicate functions in the future.
|
|
The suffix ":2" is added when message file is moved from directory "new"
to "cur".
|
|
Any directory under maildir that begin with dot and contains file
"maildirfolder" will be included as folders.
|
|
Folder is a directory under maildir that store messages per file.
A folder contains three directories: tmp, new, and cur; and an empty
file "maildirfolder".
|
|
This changes remove all unneeded methods from Manager leave it with
four methods: Delete, FetchNew, Incoming, OutgoingQueue.
Also, we add the type filename to generate file name for tmp and new
directory.
|
|
Using global debug value for all packages turns out is not a good
idea.
|
|
|
|
The libio.Reader will be deprecated and replaced with libbytes.Parser
in the future.
|
|
The libio.Reader will be deprecated and replaced with libbytes.Parser
in the future.
|
|
The libio.Reader will be deprecated and replaced with libbytes.Parser
in the future.
|
|
The libio.Reader will be deprecated and replaced with libbytes.Parser
in the future.
|
|
The libio.Reader will be deprecated and replaced with libbytes.Parser
in the future.
|
|
|
|
|