Add support for the irc+insecure address scheme
Some servers do not support TLS, or have invalid, expired or self-signed TLS certificates. While the right fix would be toi contact each server owner to add support for valid TLS, supporting plaintext upstream connections is sometimes necessary. This adds support for the irc+insecure address scheme, which connects to a network in plain-text over TCP.
This commit is contained in:
parent
19795a2321
commit
7b35757bac
@ -97,6 +97,7 @@ abbreviated form, for instance *network* can be abbreviated as *net* or just
|
||||
|
||||
_addr_ supports several connection types:
|
||||
- _[ircs://]host[:port]_ connects with TLS over TCP
|
||||
- _irc+insecure://host[:port]_ connects with plain-text TCP
|
||||
|
||||
Other options are:
|
||||
|
||||
|
@ -206,9 +206,9 @@ func handleServiceCreateNetwork(dc *downstreamConn, params []string) error {
|
||||
if addrParts := strings.SplitN(*addr, "://", 2); len(addrParts) == 2 {
|
||||
scheme := addrParts[0]
|
||||
switch scheme {
|
||||
case "ircs":
|
||||
case "ircs", "irc+insecure":
|
||||
default:
|
||||
return fmt.Errorf("unknown scheme %q (supported schemes: ircs)", scheme)
|
||||
return fmt.Errorf("unknown scheme %q (supported schemes: ircs, irc+insecure)", scheme)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,13 @@ func connectToUpstream(network *network) (*upstreamConn, error) {
|
||||
|
||||
logger.Printf("connecting to TLS server at address %q", addr)
|
||||
netConn, err = tls.DialWithDialer(&dialer, "tcp", addr, nil)
|
||||
case "irc+insecure":
|
||||
if !strings.ContainsRune(addr, ':') {
|
||||
addr = addr + ":6667"
|
||||
}
|
||||
|
||||
logger.Printf("connecting to plain-text server at address %q", addr)
|
||||
netConn, err = dialer.Dial("tcp", addr)
|
||||
default:
|
||||
return nil, fmt.Errorf("failed to dial %q: unknown scheme: %v", addr, scheme)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user