Skip to content

Commit 77275cb

Browse files
authored
Merge pull request #36 from qbit/sshcfgandlisten
Add Setter functions for SSH.sshconfig and SSH.listener
2 parents 7a361c7 + 90ab74a commit 77275cb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ssh.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ func (s *SSH) createServerKey() error {
231231
}
232232

233233
func (s *SSH) setup() error {
234+
if s.sshconfig != nil {
235+
return nil
236+
}
234237
config := &ssh.ServerConfig{
235238
ServerVersion: fmt.Sprintf("SSH-2.0-gitkit %s", Version),
236239
}
@@ -375,3 +378,13 @@ func (s *SSH) Address() string {
375378
}
376379
return ""
377380
}
381+
382+
// SetSSHConfig can be used to set custom SSH Server settings.
383+
func (s *SSH) SetSSHConfig(cfg *ssh.ServerConfig) {
384+
s.sshconfig = cfg
385+
}
386+
387+
// SetListener can be used to set custom Listener.
388+
func (s *SSH) SetListener(l net.Listener) {
389+
s.listener = l
390+
}

0 commit comments

Comments
 (0)