Gitea remote support
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
|
||||
@ -26,6 +27,7 @@ const defNetDialTimeoutSecs = 3
|
||||
// provided by *load.ProgressInfo
|
||||
type Remote interface {
|
||||
GetInfo() *RemoteInfo // Returns basic RemoteInfo struct
|
||||
String() string // String info for remote
|
||||
GetNumProjects(*RemoteQueryOpts) int // Returns total number of accessible projects
|
||||
StreamProjects(*load.ProgressInfo, *RemoteQueryOpts) // Streams projects to chans provided in load.ProgressInfo
|
||||
}
|
||||
@ -39,8 +41,10 @@ func IsAlive(remote Remote) bool {
|
||||
port = 22
|
||||
}
|
||||
|
||||
remoteUrl, _ := url.Parse(remote.GetInfo().Host)
|
||||
|
||||
d, err := net.DialTimeout("tcp",
|
||||
fmt.Sprintf("%s:%d", remote.GetInfo().Host, port),
|
||||
fmt.Sprintf("%s:%d", remoteUrl.Host, port),
|
||||
defNetDialTimeoutSecs*time.Second)
|
||||
|
||||
if err == nil {
|
||||
|
Reference in New Issue
Block a user