Commit graph

24 commits

Author SHA1 Message Date
Tobias Kohlbau
116dfa144d Add hash and signature validation
Go-self-update lacks support for checking integrity of downloaded files.
For more advanced situation it's necessary to validate the hash or
verify against public signatures. This patch adds support for
SHA2 hash and ECDSA PublicKey signature validation.
SHA2 uses file with suffix `.sha256`, whereas ECDSA uses
`.sig` file endings. See `selfupdate/validate_test.go` for examples.

Signed-off-by: Tobias Kohlbau <t.kohlbau@myopenfactory.com>
2018-11-09 11:21:21 +01:00
rhysd
d475f34e08 fix misspells 2018-03-21 19:18:46 +09:00
Jean-Baptiste Farez
a3573534f9
Add support to pass custom version to fetch from Github 2018-03-13 09:16:15 +01:00
rhysd
d5c53b8d05 do not assume tag text is always semantic versioning
regex \d+\.\d+\.\d+ is tested for repository tags. But it's not
sufficient. For example, '0.1.2.3.4' is not adopting a semantic
versioning, but can pass the regex.
2018-02-12 00:05:51 +09:00
rhysd
9b705a72eb refactoring: positional fields for struct and unnamed return value
- positional fields are better because it raises an error when missing
  field is detected
- unnamed return value is better because it introduces simpler control
  sequence. Previously I used it because rel.Version is added after
  and the parse may cause an error. But now it is parsed more earlier
  and not required in DetectLatest().
2018-02-11 23:50:21 +09:00
rhysd
02a5d46e86 do not assume a descending order (fix #11)
for testing, v0.0.9 is added to test-release-tar repository.

    https://github.com/rhysd-test/test-release-tar/releases
2018-02-11 23:22:08 +09:00
rhysd
7bcefbd709 refactoring: parse a version when an asset is detected 2018-02-11 22:57:15 +09:00
rhysd
2bc49bb7b5 add more log on detection and fix a log message 2018-02-06 13:47:59 +09:00
rhysd
7b77ed8d85 tweak document of DetectLatest() 2018-02-06 11:57:30 +09:00
rhysd
d0de60fba1 enable to have enterprise base URL and upload URL 2018-01-19 17:47:21 +09:00
rhysd
6b4eeadeb7 download an asset via GitHub Releases API by default 2018-01-19 13:30:23 +09:00
rhysd
fd492d6b01 create Updater struct to use persistent GitHub API client also for downloading assets 2018-01-19 11:35:24 +09:00
Songmu
179b999395 support tcnksm/go-gitconfig.GithubToken() 2018-01-18 19:33:31 +09:00
rhysd
f6766d9880 add more information to Release struct
- asset's size
- release name
- release time
2017-12-31 17:36:46 +09:00
rhysd
f8d9336cde implement xz support 2017-12-31 12:10:34 +09:00
rhysd
9cf8d19c61 add tests for uncompressing .zip and .gzip 2017-12-30 12:21:23 +09:00
rhysd
ed171e0fb6 fix checking response when API returns an error 2017-12-30 12:21:23 +09:00
rhysd
0c3940241c tweak fields of Release struct and add docs for them 2017-12-28 17:39:13 +09:00
rhysd
231184f71b enable to use .gzip for releases 2017-12-28 13:46:26 +09:00
rhysd
6fe53791b2 allow releases which are not archived 2017-12-27 13:08:16 +09:00
rhysd
b709a54c2d add document URL and description to Release struct 2017-12-27 12:16:26 +09:00
rhysd
7cdec8424f consider draft/prerelease and remember asset URL 2017-12-26 18:45:52 +09:00
rhysd
49bc104362 automatically detect version prefix (and omit it) 2017-12-26 12:04:43 +09:00
rhysd
1124782254 implement logger and DetectLatest() 2017-12-26 11:46:52 +09:00