@matazi/xui
Version:
x-ui api handler
124 lines (123 loc) • 3.11 kB
TypeScript
/**
* Completable with https://github.com/MHSanaei/3x-ui/
*/
export declare class X3UI {
private panelCredentials;
private axios;
private remark;
constructor(credentials: IPanelCredentials, remark: string);
login(): Promise<{
ok: boolean;
msg?: undefined;
} | {
ok: boolean;
msg: any;
}>;
createInbound(inboundData: ICreateInbound, type: StreamType): Promise<{
ok: boolean;
msg?: undefined;
} | {
ok: boolean;
msg: any;
}>;
getAllInbounds(): Promise<{
ok: boolean;
data?: undefined;
} | {
ok: boolean;
data: import("./interfaces/Inbound").Obj[];
}>;
getInboundIdByPort(port: number): Promise<{
ok: boolean;
data?: undefined;
msg?: undefined;
} | {
ok: boolean;
data: number;
msg?: undefined;
} | {
ok: boolean;
msg: any;
data?: undefined;
}>;
createClient(inboundId: number, clientData: IClient): Promise<{
ok: boolean;
msg?: undefined;
} | {
ok: boolean;
msg: any;
}>;
updateClient(inboundId: number, uuid: string, data: IClient): Promise<{
ok: boolean;
msg?: undefined;
} | {
ok: boolean;
msg: any;
}>;
deleteClient(inboundId: number, uuid: string): Promise<{
ok: boolean;
msg?: undefined;
} | {
ok: boolean;
msg: any;
}>;
getClient(inboundId: number, uuid: string): Promise<{
ok: boolean;
data: import("./interfaces/ISetting").Client;
msg?: undefined;
} | {
ok: boolean;
msg: any;
data?: undefined;
}>;
getClientStatsByUuid(inboundId: number, uuid: string): Promise<{
ok: boolean;
data: import("./interfaces/Inbound").ClientStat;
msg?: undefined;
} | {
ok: boolean;
msg: any;
data?: undefined;
}>;
getInbound(inboundId: number): Promise<any>;
realityGenerateLink(client: IClient, host: string, port: number, pbk: string, sni: string, sid: string, fpi: string): string;
private vlessRealityGenerator;
wsGenerateLink(client: IClient, protocol: Protocol, host: string, port: number, path: string, hasTls?: boolean, requestHost?: string): string;
private vlessWSGenerator;
private vmessWSGenerator;
private fixClient;
}
export declare function gbToBytes(gb: number): number;
export interface IResult {
success: boolean;
}
export interface IPanelCredentials {
baseUrl: string;
username: string;
password: string;
}
export interface ICreateInbound {
remark?: string;
port: number;
protocol: Protocol;
wsPath: string;
}
export interface IClient {
id: string;
alterId: number;
email: string;
limitIp: number;
totalGB: number;
expiryTime: number;
enable: boolean;
tgId: string;
subId: string;
}
export declare enum Protocol {
VMESS = "vmess",
VLESS = "vless"
}
export declare enum StreamType {
ws = 0,
reality = 1
}