Changeset 270 in code for trunk


Ignore:
Timestamp:
Apr 28, 2020, 9:41:13 AM (5 years ago)
Author:
delthas
Message:

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.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/soju.1.scd

    r269 r270  
    9898        _addr_ supports several connection types:
    9999        - _[ircs://]host[:port]_ connects with TLS over TCP
     100        - _irc+insecure://host[:port]_ connects with plain-text TCP
    100101
    101102        Other options are:
  • trunk/service.go

    r269 r270  
    207207                scheme := addrParts[0]
    208208                switch scheme {
    209                 case "ircs":
     209                case "ircs", "irc+insecure":
    210210                default:
    211                         return fmt.Errorf("unknown scheme %q (supported schemes: ircs)", scheme)
     211                        return fmt.Errorf("unknown scheme %q (supported schemes: ircs, irc+insecure)", scheme)
    212212                }
    213213        }
  • trunk/upstream.go

    r269 r270  
    9191                logger.Printf("connecting to TLS server at address %q", addr)
    9292                netConn, err = tls.DialWithDialer(&dialer, "tcp", addr, nil)
     93        case "irc+insecure":
     94                if !strings.ContainsRune(addr, ':') {
     95                        addr = addr + ":6667"
     96                }
     97
     98                logger.Printf("connecting to plain-text server at address %q", addr)
     99                netConn, err = dialer.Dial("tcp", addr)
    93100        default:
    94101                return nil, fmt.Errorf("failed to dial %q: unknown scheme: %v", addr, scheme)
Note: See TracChangeset for help on using the changeset viewer.