mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-06-09 20:02:26 +03:00
Use pointer receiver for all of Host
This commit is contained in:
parent
9bf1f53445
commit
18b2f511cb
6
host.go
6
host.go
@ -77,7 +77,7 @@ func (h *Host) SetMotd(motd string) {
|
|||||||
h.mu.Unlock()
|
h.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h Host) isOp(conn sshd.Connection) bool {
|
func (h *Host) isOp(conn sshd.Connection) bool {
|
||||||
key := conn.PublicKey()
|
key := conn.PublicKey()
|
||||||
if key == nil {
|
if key == nil {
|
||||||
return false
|
return false
|
||||||
@ -185,7 +185,7 @@ func (h *Host) Serve() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h Host) completeName(partial string) string {
|
func (h *Host) completeName(partial string) string {
|
||||||
names := h.NamesPrefix(partial)
|
names := h.NamesPrefix(partial)
|
||||||
if len(names) == 0 {
|
if len(names) == 0 {
|
||||||
// Didn't find anything
|
// Didn't find anything
|
||||||
@ -195,7 +195,7 @@ func (h Host) completeName(partial string) string {
|
|||||||
return names[len(names)-1]
|
return names[len(names)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h Host) completeCommand(partial string) string {
|
func (h *Host) completeCommand(partial string) string {
|
||||||
for cmd, _ := range h.commands {
|
for cmd, _ := range h.commands {
|
||||||
if strings.HasPrefix(cmd, partial) {
|
if strings.HasPrefix(cmd, partial) {
|
||||||
return cmd
|
return cmd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user