| 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/
|
|
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]
|
|
The MkdirAll create directory on the server, from left to right.
Each directory is separated by '/', where the left part is the parent of
the right part.
This method is similar to [os.MkdirAll].
|
|
The implementation of SSH server for Stat is not consistent with
the RFC.
The RFC mentioned that
An empty path name is valid, and it refers to the user's default
directory (usually the user's home directory).
But this only working on some command, like Mkdir, but not Stat.
|
|
|
|
|
|
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 Close method close the client sftp session and release all its
resources.
|
|
Since the method accept FileHandle, that is returned from OpenFIle,
then the method should changes with the same suffix.
This is also to make the method ambigous later when we add Close method
to close clinet connection.
|
|
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
|
|
The realignment reduce the cost of the following struct,
* Client: from 88 to 80 bytes (-8)
* dirEntry: from 40 to 32 bytes (-8)
* FileAttrs: from 72 to 64 bytes (-8)
* packet: from 128 to 88 bytes (-40)
While at it, add missing comment to FileHandle type.
|
|
|
|
The OpenFile method open remote file with custom flag and with specific
file attributes.
|
|
This changes check and return an error if
* the server does not support sftp subsystem as ErrSubsystem
* the client does not support the server version as ErrVersion
Some response status code from server actually can be mapped to
predefined errors from standar package, in this case
* io.EOF for SSH_FX_EOF (status code 1)
* fs.ErrNotExist for SSH_FX_NO_SUCH_FILE (status code 2)
* fs.ErrPermission for SSH_FX_PERMISSION_DENIED
Other errors are handled by wrapping ErrXxx variable withresponse message.
|
|
List of changes,
* Rename Node type to dirEntry and implement fs.DirEntry on it
* Change the Client Readdir, Readlink, and Realpath to return fs.DirEntry
* Make the response packet garbage collected by storing the result
in returned type and setting the response packet fields to nil
* Add field name to FileAttrs, which store the remote file name
* Implement fs.FileInfo interface in FileAttrs
* Store the remote path on FileHandle
|
|
The sftp package extend the golang.org/x/crypto/ssh package by
implementing "sftp" subsystem using the ssh.Client connection.
|