import { type RemoteInfo, type Socket, type SocketType } from "dgram";
import net from "net";
import { type AddressInfo } from "net";
import { type Address, type InterfaceAddresses } from "./network";
export declare class UdpTransport implements Transport {
    private socketType;
    private options;
    readonly type = "udp";
    readonly socket: Socket;
    rinfo?: Partial<Pick<RemoteInfo, "address" | "port">>;
    onData: (data: Buffer, addr: Address) => void;
    closed: boolean;
    private constructor();
    static init(type: SocketType, options?: {
        portRange?: [number, number];
        port?: number;
        interfaceAddresses?: InterfaceAddresses;
    }): Promise<UdpTransport>;
    private init;
    send: (data: Buffer, addr?: Address) => Promise<void>;
    get address(): net.AddressInfo;
    get host(): string;
    get port(): number;
    close: () => Promise<void>;
}
export declare class TcpTransport implements Transport {
    private addr;
    readonly type = "tcp";
    private connecting;
    private client;
    onData: (data: Buffer, addr: Address) => void;
    closed: boolean;
    private constructor();
    private connect;
    private init;
    static init(addr: Address): Promise<TcpTransport>;
    get address(): AddressInfo;
    send: (data: Buffer, addr?: Address) => Promise<void>;
    close: () => Promise<void>;
}
export interface Transport {
    type: string;
    address: AddressInfo;
    closed: boolean;
    onData: (data: Buffer, addr: Address) => void;
    send: (data: Buffer, addr?: Address) => Promise<void>;
    close: () => Promise<void>;
}
