summaryrefslogtreecommitdiff
path: root/internal/ssh/client/customkeycallback.go
blob: 0107895be21d0e7027652e2e8e062a627fc1bb91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package client

import (
	"context"
	"net"

	"golang.org/x/crypto/ssh"
)

// CustomCallback is a custom host key callback wrapper.
type CustomCallback struct{}

// NewCustomCallback returns a new wrapper.
func NewCustomCallback() (*CustomCallback, error) {
	h := CustomCallback{}
	return &h, nil
}

// Wrap the host key callback. ctx is accepted for interface compatibility
// but the custom callback never blocks so it has nothing to abort.
func (h *CustomCallback) Wrap(_ context.Context) ssh.HostKeyCallback {
	return func(server string, remote net.Addr, key ssh.PublicKey) error {
		return nil
	}
}