mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-12-24 11:51:13 +08:00
43 lines
986 B
Go
43 lines
986 B
Go
package action
|
|
|
|
import (
|
|
"path/filepath"
|
|
"sync"
|
|
"time"
|
|
|
|
"gopkg.in/natefinch/lumberjack.v2"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
"k8s.io/client-go/metadata/metadatainformer"
|
|
|
|
"github.com/wencaiwulue/kubevpn/v2/pkg/config"
|
|
"github.com/wencaiwulue/kubevpn/v2/pkg/daemon/rpc"
|
|
"github.com/wencaiwulue/kubevpn/v2/pkg/handler"
|
|
)
|
|
|
|
type Server struct {
|
|
rpc.UnimplementedDaemonServer
|
|
|
|
Cancel func()
|
|
GetClient func(isSudo bool) (rpc.DaemonClient, error)
|
|
IsSudo bool
|
|
LogFile *lumberjack.Logger
|
|
Lock sync.Mutex
|
|
|
|
t time.Time
|
|
connect *handler.ConnectOptions
|
|
clone *handler.CloneOptions
|
|
secondaryConnect []*handler.ConnectOptions
|
|
|
|
resourceLists []*metav1.APIResourceList
|
|
informer metadatainformer.SharedInformerFactory
|
|
|
|
ID string
|
|
}
|
|
|
|
func GetDaemonLogPath(isSudo bool) string {
|
|
if isSudo {
|
|
return filepath.Join(config.DaemonPath, config.SudoLogFile)
|
|
}
|
|
return filepath.Join(config.DaemonPath, config.UserLogFile)
|
|
}
|