Move RemoteInfo and CloneProto to info package
This commit is contained in:
@ -1,24 +1,15 @@
|
||||
package remote
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/info"
|
||||
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/load"
|
||||
)
|
||||
|
||||
type RemoteInfo struct {
|
||||
Ctx context.Context
|
||||
Host string
|
||||
Name string
|
||||
Token string
|
||||
CloneProto config.CloneProto
|
||||
}
|
||||
|
||||
const defNetDialTimeoutSecs = 3
|
||||
|
||||
// Any remote needs to be able to return
|
||||
@ -26,8 +17,9 @@ const defNetDialTimeoutSecs = 3
|
||||
// stream all projects along with updates to channels
|
||||
// provided by *load.ProgressInfo
|
||||
type Remote interface {
|
||||
GetInfo() *RemoteInfo // Returns basic RemoteInfo struct
|
||||
String() string // String info for remote
|
||||
GetInfo() *info.RemoteInfo // Returns basic RemoteInfo struct
|
||||
GetType() string // Returns the remote type (e.g. GitLab, Gitea)
|
||||
GetNumProjects(*RemoteQueryOpts) int // Returns total number of accessible projects
|
||||
StreamProjects(*load.ProgressInfo, *RemoteQueryOpts) // Streams projects to chans provided in load.ProgressInfo
|
||||
}
|
||||
@ -35,9 +27,9 @@ type Remote interface {
|
||||
func IsAlive(remote Remote) bool {
|
||||
var port int
|
||||
switch remote.GetInfo().CloneProto {
|
||||
case config.CloneProtoHTTP:
|
||||
case info.CloneProtoHTTP:
|
||||
port = 443
|
||||
case config.CloneProtoSSH:
|
||||
case info.CloneProtoSSH:
|
||||
port = 22
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user