Initial connection upgrade/TLS peering support

This commit is contained in:
Neil Alexander 2019-10-23 17:26:35 +01:00
parent 9cb553e939
commit 6a22e6c9de
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
4 changed files with 167 additions and 27 deletions

View file

@ -93,9 +93,11 @@ func (l *link) call(uri string, sintf string) error {
pathtokens := strings.Split(strings.Trim(u.Path, "/"), "/")
switch u.Scheme {
case "tcp":
l.tcp.call(u.Host, nil, sintf)
l.tcp.call(u.Host, nil, sintf, nil)
case "socks":
l.tcp.call(pathtokens[0], u.Host, sintf)
l.tcp.call(pathtokens[0], u.Host, sintf, nil)
case "tls":
l.tcp.call(u.Host, nil, sintf, l.tcp.tls.forDialer)
default:
return errors.New("unknown call scheme: " + u.Scheme)
}
@ -109,7 +111,10 @@ func (l *link) listen(uri string) error {
}
switch u.Scheme {
case "tcp":
_, err := l.tcp.listen(u.Host)
_, err := l.tcp.listen(u.Host, nil)
return err
case "tls":
_, err := l.tcp.listen(u.Host, l.tcp.tls.forListener)
return err
default:
return errors.New("unknown listen scheme: " + u.Scheme)