Skip to content

Commit

Permalink
Merge pull request #55 from mstruebing/fix/54/reachable
Browse files Browse the repository at this point in the history
fix: Get port from Scheme
  • Loading branch information
mstruebing authored Sep 16, 2020
2 parents 6c123be + b924f76 commit 1689203
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
36 changes: 28 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,49 @@
# Changelog

## Unreleased

### Added

### Changed

### Deprecated

### Removed

### Fixed

- Get port from scheme [#55](https://github.com/mstruebing/tldr/pull/55) ([@mstruebing](https://github.com/mstruebing))

### Security

### Misc

## [1.2.1] - 2020-07-29
* Only check remote is reachable when ttl timeout. [#52](https://github.com/mstruebing/tldr/pull/52) ([@wudong](https://github.com/wudong))

- Only check remote is reachable when ttl timeout. [#52](https://github.com/mstruebing/tldr/pull/52) ([@wudong](https://github.com/wudong))

## [1.2.0] - 2020-03-06

### Added
* Added docker container [#50](https://github.com/mstruebing/tldr/pull/50) ([@mstruebing](https://github.com/mstruebing))

- Added docker container [#50](https://github.com/mstruebing/tldr/pull/50) ([@mstruebing](https://github.com/mstruebing))

### Changed
* Only load new cache when connected to the internet and remote host is reachable [#49](https://github.com/mstruebing/tldr/pull/49) ([@mstruebing](https://github.com/mstruebing))
* Switched to go mod [47](https://github.com/mstruebing/tldr/pull/47) ([@mstruebing](https://github.com/mstruebing))

- Only load new cache when connected to the internet and remote host is reachable [#49](https://github.com/mstruebing/tldr/pull/49) ([@mstruebing](https://github.com/mstruebing))
- Switched to go mod [47](https://github.com/mstruebing/tldr/pull/47) ([@mstruebing](https://github.com/mstruebing))

### Fixed
* golang ci errors

- golang ci errors

## [1.1.1] - 2019-02-19

### Changed
* the chache directory now follows the XDG-standard (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
* removed 1.8/1.9/1.10 from travis and only use the latest 2 versions

- the chache directory now follows the XDG-standard (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
- removed 1.8/1.9/1.10 from travis and only use the latest 2 versions

### Fixed
* only consider markdown files as pages (as there was an `index.json`-file added)

- only consider markdown files as pages (as there was an `index.json`-file added)
9 changes: 8 additions & 1 deletion cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,14 @@ func (r Repository) isReachable() bool {

seconds := 5
timeout := time.Duration(seconds) * time.Second
var port string

_, err = net.DialTimeout("tcp", u.Hostname()+":"+u.Port(), timeout)
if u.Scheme == "https" {
port = "443"
} else if u.Scheme == "http" {
port = "80"
}

_, err = net.DialTimeout("tcp", u.Hostname()+":"+port, timeout)
return err == nil
}
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/unidoc/unioffice v1.5.0 h1:RxPbPMBgKJ7gbqVlq/gZ+zd0gWWfvDUhm2ODbyMdfZk=
github.com/unidoc/unioffice v1.5.0/go.mod h1:7wl8btOkZW1TfqfpDWoujRXkUpowwisGRYDo7COHBiI=

0 comments on commit 1689203

Please sign in to comment.