mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-21 19:24:37 +02:00
move max connections from config to db
This commit is contained in:
parent
a0001aaa74
commit
21e9edd201
4 changed files with 6 additions and 5 deletions
|
@ -113,7 +113,8 @@ export const exitNodes = pgTable("exitNodes", {
|
||||||
endpoint: varchar("endpoint").notNull(),
|
endpoint: varchar("endpoint").notNull(),
|
||||||
publicKey: varchar("publicKey").notNull(),
|
publicKey: varchar("publicKey").notNull(),
|
||||||
listenPort: integer("listenPort").notNull(),
|
listenPort: integer("listenPort").notNull(),
|
||||||
reachableAt: varchar("reachableAt")
|
reachableAt: varchar("reachableAt"),
|
||||||
|
maxConnections: integer("maxConnections")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const users = pgTable("user", {
|
export const users = pgTable("user", {
|
||||||
|
|
|
@ -117,7 +117,8 @@ export const exitNodes = sqliteTable("exitNodes", {
|
||||||
endpoint: text("endpoint").notNull(), // this is how to reach gerbil externally - gets put into the wireguard config
|
endpoint: text("endpoint").notNull(), // this is how to reach gerbil externally - gets put into the wireguard config
|
||||||
publicKey: text("publicKey").notNull(),
|
publicKey: text("publicKey").notNull(),
|
||||||
listenPort: integer("listenPort").notNull(),
|
listenPort: integer("listenPort").notNull(),
|
||||||
reachableAt: text("reachableAt") // this is the internal address of the gerbil http server for command control
|
reachableAt: text("reachableAt"), // this is the internal address of the gerbil http server for command control
|
||||||
|
maxConnections: integer("maxConnections")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const users = sqliteTable("user", {
|
export const users = sqliteTable("user", {
|
||||||
|
|
|
@ -162,7 +162,6 @@ export const configSchema = z
|
||||||
gerbil: z
|
gerbil: z
|
||||||
.object({
|
.object({
|
||||||
exit_node_name: z.string().optional(),
|
exit_node_name: z.string().optional(),
|
||||||
max_connections: z.number().positive().gt(0).optional(),
|
|
||||||
start_port: portSchema
|
start_port: portSchema
|
||||||
.optional()
|
.optional()
|
||||||
.default(51820)
|
.default(51820)
|
||||||
|
|
|
@ -25,8 +25,8 @@ export const handleNewtPingRequestMessage: MessageHandler = async (context) => {
|
||||||
// higher = more desirable
|
// higher = more desirable
|
||||||
|
|
||||||
let weight = 1;
|
let weight = 1;
|
||||||
const maxConnections = config.getRawConfig().gerbil.max_connections;
|
const maxConnections = node.maxConnections;
|
||||||
if (maxConnections !== undefined) {
|
if (maxConnections !== null && maxConnections !== undefined) {
|
||||||
const [currentConnections] = await db
|
const [currentConnections] = await db
|
||||||
.select({
|
.select({
|
||||||
count: count()
|
count: count()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue