| Age | Commit message (Collapse) | Author |
|
=== New features
* ssh/config: add method MarshalText and WriteTo
* lib/ssh: implement method Output on Client
* ssh/sftp: implement method MkdirAll on Client
* cmd/httpdfs: implement [libhttp.Server] with [memfs.MemFS]
=== Breaking changes
* ssh/config: refactoring the Config merge
* ssh/config: add parameter Config to NewSection
* lib/ssh: add parameter context to Execute method
* lib/time: remove UnixMicro and UnixMilli
* lib/io: removed, this package has been merged into "lib/os"
* lib/parser: removed, this package has been merged into lib/strings
=== Bug fixes
* ssh/config: fix setting the default values
* ssh/config: set the Hostname if its not set on [Config.Get]
* http/sseclient: fix data race on [Client.Close]
* http/sseclient: fix Retry value not set to millisecond
* ssh/sftp: fix Stat on empty remote file name
* ssh/sftp: fix non-nil returned error on Close
=== Enhancements
* ssh/config: merge the Section slice values on [Section.merge]
* ssh/config: set the default UserKnownHostsFile in setDefaults
|
|
This changes rename method [Config.Prepend] to [Config.Merge].
The way that how the other Config merged is changed.
Instead of appending all of other's sections into the current Config,
append the other Config instance to the current instance of Config.
During [Config.Get] the top Config will be evaluated first, and then the
other Config is evaluated in order of Merge.
|
|
Instead of using [Section.Set], set the key-value directly.
While at it, merge the certificateFile, IdentityFile, knownHostFiles,
and sendEnv.
|
|
While at it, unfold each value of IdentityFile and UserKnownHostsFile
in setDefaults, by expanding "~" into user's home directory or joining
with "config" directory if its relative.
|
|
Make it clear that the passed parameter is a host name and the returned
section will contains default values if no host or match found.
|
|
This changes how the Section and parser initialized.
Previously, the Config depends on the parser to set the workDir and
homeDir and Section depends on Config only on Get; now its the other
way around, from top to bottom.
Config initialized first, then parser initialized using Config instance,
and then Section initialized also using Config instance.
|
|
The field default value should be set on Get, after all the Host or
Match fields merged.
In this way, if the field key already set, its not overridden by the
default value or subsequent Host or Match vaue.
|
|
This changes require the fork of our golang.org/x/crypto.
|
|
|
|
Per manual ssh_config(5) on Hostname,
The default is the name given on the command line.
So, if the requested host name match with one of Host or Match, but
Hostname is not set, it should be default to the requested parameter
name.
|
|
Using test.Data make the output easy to audit and modified.
|
|
|
|
|
|
The MarshalText method encode the Section back to ssh_config format
with two spaces as indentation in key.
The WriteTo method marshal the Section into text and write it to
[io.Writer] w.
|
|
The data race happened when Close set conn to nil but the consume
method still on Read.
The fix is by waiting for 100ms so consume goroutine can check if closeq
is triggered from Close or not.
|
|
When client receive "retry:" message, the value is in millisecond, but
when we store it we only convert it to [time.Duration] which default
to nanosecond.
While at it, update comments on field [Client.Retry] and
[Client.Insecure].
|
|
The original idea of providing Now is to mock the current time in
testing Scheduler.
Since this variable can be overridden by other packages, it is not safe
to export it, hence we un-export it here so it can be used internal only.
|
|
Both of those methods has been added into standard library as
[Time.UnixMicro] and [Time.UnixMilli] since Go 1.17.
|
|
The Output method run the command and return its standard output and
error as is.
Any other error beside standard error, like connection, will be returned
as error.
|
|
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.
|
|
This is to make sure that the passed value is in the correct, expected
size.
|
|
|
|
|
|
While some functions are merged to lib/os, some are not used anymore
like io.Reader.
|
|
|
|
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.
|
|
While at it,
* cleaning up the PKGBUILD,
* remove unused prepare(), and
* use "make build" to build directly without running test and lint.
|
|
The httpdfs accept single directory to be served under HTTP server,
with the following options,
-address <IP:PORT>
Run the HTTP server on specific IP address and port.
Default to ` + defAddress + `.
-exclude <regex>
Exclude the files matched by regex from being served.
Default to empty, none of files is excluded.
-help
Print this usage.
-include <regex>
Serve only list of files matched with regex.
Default to include CSS, HTML, JavaScript, ICO, JPG, PNG, and
SVG files only.
-version
Print the program version.
|
|
If the parameter withContent is true, which is default in MarshalJSON,
then all of the node content will be included in JSON output.
This also changes the parameter withoutModTime to withModTime because
working with negation make code not easy to read.
|
|
=== New features
* lib/http: implement Server-Sent Events (SSE)
* lib/net: add method Read
* lib/crypto: add support for reading passphrase using SSH_ASKPASS
* lib/memfs: add method JSON to Node
=== Enhancements
* lib/ini: create the file if its not exist on Open
* lib/net: use [time.Ticker] to loop in WaitAlive
* lib/memfs: add sub file system
* lib/memfs: improve the refresh method
* lib/ini: append variable into section before any empty lines
* lib/memfs: stop all Watcher spawn by DirWatcher
* lib/memfs: remove embedding os.FileInfo and http.File
* lib/memfs: refactoring, simplify DirWatcher logic
* email/dkim: set ExpiredAt to MaxInt64 if value is greater than 12 digits
|
|
|
|
When running the EventSource client in Firefox, we found out that when
server send a multi line content with empty line in the middle, the empty
line is ignored by Firefox.
Just to make sure we test it here and the server send it as expected
event:message\ndata:line 1\ndata:\ndata:line2\ndata:\ndata:\n\n
This case is similar with case number 3 when testing raw data.
So probably this is bug in our implementation of SSE in another project.
|
|
The KeepAliveInterval define the interval where server will send a
an empty message ":\n\n" to active connection periodically.
This field is optional, default and minimum value is 5 seconds.
|
|
The IDInt return the ID as int64.
If the ID cannot be converted to integer it would return 0.
|
|
Using the WriteEvent alone, we can skip writing "event:" line if the
passed "event" parameter is empty, and write the rest of data and/or id.
|
|
|
|
The Timeout field in net.Dialer sometimes does not have any effect.
In the for-loop, we expect that each Dial at least consume 100 ms
before returning an error.
Turns out, on several occasion, the loop run too quickly, less than the
passed timeout.
This is probably because the listening address has not been
active yet and we run it in the same machine, the OS (or Go?) return
immediately without waiting for timeout.
|
|
This changes everything.
On the server we split the SSEEndpoint to new type SSEConn, so each
callback use different instance of conn.
On the Client, we need to store the parsed serverUrl and the passed
header so it can be reused.
|
|
Let the parseEvent handle and check for empty packet.
|
|
The WriteRaw method write raw event message directly, without any
parsing.
|
|
Server can send empty ID to signal client that the ID has been reset or
set to empty value.
|
|
For server SSE, we add new type SSEEndpoint, for registering endpoint
that can handle SSE.
For client SSE, we add it in new sub package "sseclient".
Implements: https://todo.sr.ht/~shulhan/share/1
Implements: https://todo.sr.ht/~shulhan/share/2
Signed-off-by: Shulhan <ms@kilabit.info>
|
|
The Read method read packet from raw connection.
If the conn parameter is nil it will return [net.ErrClosed].
The bufsize parameter set the size of buffer for each read operation,
default to 1024 if not set or invalid (less than 0 or greater than
65535).
The timeout parameter set how long to wait for data before considering
it as failed.
If its not set, less or equal to 0, it will wait forever.
If no data received and timeout is set, it will return [ErrReadTimeout].
If there is data received and connection closed at the same time, it will
return the data first without error.
The subsequent Read will return empty packet with [ErrClosed].
Signed-off-by: Shulhan <ms@kilabit.info>
|
|
This implemented simplified version of merging multiple MemFS instances.
The sub file system (subfs) can be added to the parent MemFS instance
by calling new method "Merge".
parent.Merge(other *MemfS)
When Get method called, each subfs will be evaluated in order of Merge
called.
This deprecated the function Merge.
|
|
|
|
Another error for handling fs.ErrNotExist when scanning directory
which is may caused by broken symlink.
|
|
If user press enter on the GUI, the returned password will contains line
feed, which makes the password invalid.
|
|
If the library failed to changes os.Stdin to raw, it will try to use
a program defined in SSH_ASKPASS environment variable.
The SSH_ASKPASS is controlled by environment SSH_ASKPASS_REQUIRE.
- If SSH_ASKPASS_REQUIRE is empty the passphrase will read from
terminal first, if not possible then using SSH_ASKPASS program.
- If SSH_ASKPASS_REQUIRE is set to "never" the passphrase will read
from terminal only.
- If SSH_ASKPASS_REQUIRE is set to "prefer", the passphrase will read
using SSH_ASKPASS program not from terminal, but require
DISPLAY environment to be set.
- If SSH_ASKPASS_REQUIRE is set to "force", the passphrase will read
using SSH_ASKPASS program not from terminal, without checking DISPLAY
environment.
This changes affect the [ssh.NewClientInteractive] indirectly.
|
|
|