mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-29 03:23:56 +01:00
d4a3ee9d87
This PR fixes issues with the terminal when running netbird ssh to a remote agent. Every session looks up a user and loads its profile. If no user is found, the connection is rejected. The default user is root.
25 lines
503 B
Go
25 lines
503 B
Go
package util
|
|
|
|
import "os"
|
|
|
|
// SliceDiff returns the elements in slice `x` that are not in slice `y`
|
|
func SliceDiff(x, y []string) []string {
|
|
mapY := make(map[string]struct{}, len(y))
|
|
for _, val := range y {
|
|
mapY[val] = struct{}{}
|
|
}
|
|
var diff []string
|
|
for _, val := range x {
|
|
if _, found := mapY[val]; !found {
|
|
diff = append(diff, val)
|
|
}
|
|
}
|
|
return diff
|
|
}
|
|
|
|
// FileExists returns true if specified file exists
|
|
func FileExists(path string) bool {
|
|
_, err := os.Stat(path)
|
|
return err == nil
|
|
}
|