╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ serve.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
90 91 try err.print("serving HTTP on {s}, repo root {s}\n", .{ options.http_listen, repo_root_path }); 92 try err.flush(); 93 94 serve_http.runListener(repo_kind, any_repo_opts, io, allocator, repo_root_path, admin_repo_path, &http_server, &tasks, err); 95 96 try err.print("serving SSH on {s}\n", .{options.ssh_listen}); 97 try err.flush(); 98 99 const ssh_session_handler = serve_ssh.SessionHandler{ 100 .admin_repo_path = admin_repo_path, 101 .repo_root_path = repo_root_path, 102 .wui_port = wui_listen_address.port, 103 .err = err, 104 }; 105 serve_ssh.runListener(io, allocator, &host_key, &ssh_session_handler, &ssh_server, &tasks, err); 106 107 try err.print("serving web UI on http://{s}/\n", .{options.wui_listen}); 108 try err.flush(); 109 110 web.run(io, allocator, &wui_server, &tasks, admin_repo_path, session_store, err); 111 112 if (@TypeOf(runnable) != void) { 113 try runnable.run(); 114 } else { 115 try tasks.await(io); 116 } 117 } 118 119 fn parseListenAddress(value: []const u8) !ListenAddress { 120 const colon = std.mem.lastIndexOfScalar(u8, value, ':') orelse return error.InvalidListenAddress; 121 if (colon == 0 or colon + 1 >= value.len) return error.InvalidListenAddress; 122 const port = try std.fmt.parseInt(u16, value[colon + 1 ..], 10); 123 return .{ .host = value[0..colon], .port = port }; 124 } 125