70 Commits

Author SHA1 Message Date
Sylvie Crowe 6409e4292f fix: persist ignoreMatchDirective to included file (#6)
The ignoreMatchDirective flag did not exist in the newConfig function.
Because this function is called when generating a config for connections
in an included file, those connections automatically assumed the value
was false. This change adds the flag so it can be changed to true if it
is also set for the outer configuration.
2024-12-19 12:37:47 -08:00
Sylvie Crowe ed12436768 Allow User to Ignore Match Directive (#5)
* Add the possibility to ignore the Match directive

* cleanup

* cleanup

* cleanup

* cleanup

* fix: duplicated code leftover from merge

* fix: match directive bypass for GetAll

The new ignoreMatchDirective flag needed to be added in one other place.

---------

Co-authored-by: fferro <francesco.ferro@yahooinc.com>
2024-10-27 16:23:32 -07:00
Sylvie Crowe 17e2087ebd Update IdentityFile Defaults to Match Documentation (#4)
Credit to @virtuald for the original implementation of this fix.

* Add support for retrieving all IdentityFile directives via DefaultAll

* fix: set IdentityFile defaults to match man page

The existing default IdentityFile list was incomplete and out of order.
This updates it to match the defaults listed here:
https://man7.org/linux/man-pages/man5/ssh_config.5.html

---------

Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
2024-03-05 20:10:34 -08:00
Sylvie Crowe cba6b6a60f Add reload config (#2)
* add function that can clear cached config files

Once the first call to `Get()`, `GetStrict()`, `GetAll()`,
or`GetAllStrict()` has been made, the contents of the config files will
be cached for all future calls to any of those functions. This can be
frustrating if the user wants to capture changes to the config file that
were made externally. This
change adds the `ClearCachedConfigs()` function to provide control over
that.

* change ClearCachedConfigs to ReloadConfigs

Clearing cached data is somewhat vague and could be more confusing to
users who are not familiar with this library. But Reloading the config
data is very straightforward. For this reason, the ability to clear the
cache has been replaced with the ability to reload.

The reload simply clears the cache and then loads the contents again.

Additionally, this contains a bug fix that ensure the loadConfigs
pointer is set to a non-null value before it is used.

* add tests for reloading ssh config files

This adds 2 tests. The first checks that ssh config data is cached and
does not update if the file changes afterward. The second checks that
the `ReloadConfigs()` function will discard the cached data and load the
current config file contents.
2024-03-05 19:38:17 -08:00
Kevin Burke 1d09c0b505 .github: set latest Go versions 2023-10-21 21:24:32 -07:00
Kevin Burke 974a52c2c0 .github: use Go 1.19 2022-11-25 07:46:23 -08:00
Kevin Burke 3c7724c1bb README.md: update donate information 2022-11-08 20:20:52 -08:00
Kevin Burke 7df8445052 go.mod: add 2022-06-15 09:39:52 -07:00
Kevin Burke a56e914e72 .github: run lint only on Go 1.18 2022-06-05 13:48:31 -07:00
Kevin Burke 5724bd1279 config: add UserSettings.ConfigFinder
Fixes #48.
2022-06-05 12:47:11 -07:00
Kevin Burke aae6f39972 1.2 2022-03-31 11:37:00 -07:00
Kevin Burke df4d8e6716 config: update version to match git tags 2022-03-31 11:36:52 -07:00
Kevin Burke f6c7111323 Makefile: add tag prefix to release command
This makes go.mod happier.
2022-03-31 10:59:35 -07:00
Scott Lessans 9b1b4df300 config: fix EOL whitespace for key/value pairs and Host lines
See the description in the CHANGELOG - we were handling this
incorrectly and attaching whitespace to the end of values where that
didn't make much sense to do.
2022-03-31 10:57:24 -07:00
Carlos A Becker 91cd224c7f config: add DecodeBytes to directly read a byte array
Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2022-03-31 09:49:09 -07:00
Kevin Burke a432d6fbae README: add more information 2022-03-31 09:31:12 -07:00
Kevin Burke 6ad71ac26e config: remove io/ioutil
It's deprecated now.
2022-03-31 09:26:24 -07:00
Kevin Burke 0970dd2cc4 .github: add latest Go versions to CI 2022-03-31 09:22:50 -07:00
Kevin Burke c7f8dec5c7 fuzz_test: add fuzz tests
Also add a sample corpus.
2021-11-02 14:58:53 -07:00
Kevin Burke beb851b6a4 AUTHORS.txt: add Dustin Spicuzza 2021-03-27 13:54:12 -07:00
Dustin Spicuzza 124166206d Support retrieving multiple values for a given keyword
IdentityFile among others supports being provided multiple times and
aggregated across, potentially, multiple files. Support that workflow
by adding GetAll and GetAllStrict alongside the current functions.
2021-03-27 13:38:21 -07:00
Kevin Burke 42c0635e2f .github: add github actions 2021-03-27 10:07:43 -07:00
santosh653 4977a11b43 travis.yml: test ppc64le 2020-11-05 21:09:09 -08:00
santosh653 62d16166c6 Update .travis.yml
Adding Power Support
2020-11-05 21:08:12 -08:00
Kevin Burke 5a772a75fa travis.yml: test latest Go versions
Staticcheck only works going back to Go 1.13 so only test that far
back.
2020-11-05 21:06:12 -08:00