mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 04:42:33 +02:00

* use auto generated schemas * go version bump and dependencies upgrade * clarify some error messages --------- Co-authored-by: yusing <yusing@6uo.me>
66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import { CIDR, HTTPHeader, HTTPMethod, StatusCodeRange, URI } from "../types";
|
|
|
|
export const ACCESS_LOG_FORMATS = ["combined", "common", "json"] as const;
|
|
|
|
export type AccessLogFormat = (typeof ACCESS_LOG_FORMATS)[number];
|
|
|
|
export type AccessLogConfig = {
|
|
/**
|
|
* The size of the buffer.
|
|
*
|
|
* @minimum 0
|
|
* @default 65536
|
|
* @TJS-type integer
|
|
*/
|
|
buffer_size?: number;
|
|
/** The format of the access log.
|
|
*
|
|
* @default "combined"
|
|
*/
|
|
format?: AccessLogFormat;
|
|
/* The path to the access log file. */
|
|
path: URI;
|
|
/* The access log filters. */
|
|
filters?: AccessLogFilters;
|
|
/* The access log fields. */
|
|
fields?: AccessLogFields;
|
|
};
|
|
|
|
export type AccessLogFilter<T> = {
|
|
/** Whether the filter is negative.
|
|
*
|
|
* @default false
|
|
*/
|
|
negative?: boolean;
|
|
/* The values to filter. */
|
|
values: T[];
|
|
};
|
|
|
|
export type AccessLogFilters = {
|
|
/* Status code filter. */
|
|
status_code?: AccessLogFilter<StatusCodeRange>;
|
|
/* Method filter. */
|
|
method?: AccessLogFilter<HTTPMethod>;
|
|
/* Host filter. */
|
|
host?: AccessLogFilter<string>;
|
|
/* Header filter. */
|
|
headers?: AccessLogFilter<HTTPHeader>;
|
|
/* CIDR filter. */
|
|
cidr?: AccessLogFilter<CIDR>;
|
|
};
|
|
|
|
export const ACCESS_LOG_FIELD_MODES = ["keep", "drop", "redact"] as const;
|
|
export type AccessLogFieldMode = (typeof ACCESS_LOG_FIELD_MODES)[number];
|
|
|
|
export type AccessLogField = {
|
|
default?: AccessLogFieldMode;
|
|
config: {
|
|
[key: string]: AccessLogFieldMode;
|
|
};
|
|
};
|
|
|
|
export type AccessLogFields = {
|
|
header?: AccessLogField;
|
|
query?: AccessLogField;
|
|
cookie?: AccessLogField;
|
|
};
|