github.com/devops-filetransfer/sshego@v7.0.4+incompatible/uhp.go (about) 1 package sshego 2 3 import "fmt" 4 5 // UHP provides User and HostPort strings 6 // to identify a remote destination. 7 type UHP struct { 8 User string 9 HostPort string // IP:port or hostname:port 10 Nickname string 11 } 12 13 func (a UHP) String() string { 14 return fmt.Sprintf("%s@%s/%s", a.User, a.HostPort, a.Nickname) 15 } 16 17 // UHPEqual returns true iff a and b are both 18 // not nil and they have equal fields. 19 func UHPEqual(a, b *UHP) bool { 20 if a == nil || b == nil { 21 panic("cannot call UHPEqual with nil(s)") 22 } 23 if a.User != b.User { 24 return false 25 } 26 return a.HostPort == b.HostPort 27 }