// Start starts the app.
Start starts the app.
// Start starts the app .
func (a *App) Start() error {
	for _, s := range a.Servers {
		for _, addr := range s.listenAddrs {
			for i := uint(0); i < addr.PortRangeSize(); i++ {
				var lnAddr string
				if strings.Contains(addr.Network, "udp") {
					pc, err := caddy.ListenPacket(addr.Network, addr.JoinHostPort(i))
					if err != nil {
						return err
					}
					a.packetConns = append(a.packetConns, pc)
					lnAddr = pc.LocalAddr().Network() + "/" + pc.LocalAddr().String()
					go s.servePacket(pc)
				} else {
					ln, err := caddy.Listen(addr.Network, addr.JoinHostPort(i))
					if err != nil {
						return err
					}
					a.listeners = append(a.listeners, ln)
					lnAddr = ln.Addr().Network() + "/" + ln.Addr().String()
					go s.serve(ln)
				}
				s.logger.Debug("listening", zap.String("address", lnAddr))
			}
		}
	}
	return nil
}
func ( a * App ) Start ( ) error { for _ , s := range a . Servers { for _ , addr := range s . listenAddrs { for i := uint ( 0 ) ; i < addr . PortRangeSize ( ) ; i ++ { var lnAddr string if strings . Contains ( addr . Network , " " ) { pc , err := caddy . ListenPacket ( addr . Network , addr . JoinHostPort ( i ) ) if err != nil { return err } a . packetConns = append ( a . packetConns , pc ) lnAddr = pc . LocalAddr ( ) . Network ( ) + " " + pc . LocalAddr ( ) . String ( ) go s . servePacket ( pc ) } else { ln , err := caddy . Listen ( addr . Network , addr . JoinHostPort ( i ) ) if err != nil { return err } a . listeners = append ( a . listeners , ln ) lnAddr = ln . Addr ( ) . Network ( ) + " " + ln . Addr ( ) . String ( ) go s . serve ( ln ) } s . logger . Debug ( " " , zap . String ( " " , lnAddr ) ) } } } return nil }
Start starts the app.
Start starts the app .