Changeset 694 in code for trunk


Ignore:
Timestamp:
Nov 17, 2021, 10:41:11 AM (4 years ago)
Author:
contact
Message:

Add config option to globally disable multi-upstream mode

Closes: https://todo.sr.ht/~emersion/soju/122

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/cmd/soju/main.go

    r691 r694  
    9393                AcceptProxyIPs:  raw.AcceptProxyIPs,
    9494                MaxUserNetworks: raw.MaxUserNetworks,
     95                MultiUpstream:   raw.MultiUpstream,
    9596                Debug:           debug,
    9697                MOTD:            motd,
  • trunk/config/config.go

    r662 r694  
    5252
    5353        MaxUserNetworks int
     54        MultiUpstream   bool
    5455}
    5556
     
    6465                SQLSource:       "soju.db",
    6566                MaxUserNetworks: -1,
     67                MultiUpstream:   true,
    6668        }
    6769}
     
    139141                                return nil, fmt.Errorf("directive %q: %v", d.Name, err)
    140142                        }
     143                case "multi-upstream-mode":
     144                        var str string
     145                        if err := d.ParseParams(&str); err != nil {
     146                                return nil, err
     147                        }
     148                        v, err := strconv.ParseBool(str)
     149                        if err != nil {
     150                                return nil, fmt.Errorf("directive %q: %v", d.Name, err)
     151                        }
     152                        srv.MultiUpstream = v
    141153                default:
    142154                        return nil, fmt.Errorf("unknown directive %q", d.Name)
  • trunk/doc/soju.1.scd

    r691 r694  
    153153        bound to a specific network. By default, no MOTD is sent.
    154154
     155*multi-upstream-mode* true|false
     156        Globally enable or disable multi-upstream mode. By default, multi-upstream
     157        mode is enabled.
     158
    155159# IRC SERVICE
    156160
  • trunk/downstream.go

    r693 r694  
    11721172        }
    11731173
    1174         if dc.network == nil && !dc.caps["soju.im/bouncer-networks"] {
     1174        if dc.network == nil && !dc.caps["soju.im/bouncer-networks"] && dc.srv.Config().MultiUpstream {
    11751175                dc.isMultiUpstream = true
    11761176        }
  • trunk/server.go

    r691 r694  
    6262        AcceptProxyIPs  config.IPSet
    6363        MaxUserNetworks int
     64        MultiUpstream   bool
    6465        MOTD            string
    6566}
     
    8687                users:     make(map[string]*user),
    8788        }
    88         srv.config.Store(&Config{Hostname: "localhost", MaxUserNetworks: -1})
     89        srv.config.Store(&Config{
     90                Hostname:        "localhost",
     91                MaxUserNetworks: -1,
     92                MultiUpstream:   true,
     93        })
    8994        return srv
    9095}
Note: See TracChangeset for help on using the changeset viewer.