Skip to content

Commit

Permalink
Extract user-agent agent into constants
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Jun 14, 2024
1 parent f295a6a commit cc9953e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const DEFAULT_ADDRESS = process.platform === 'win32'
? { port: 27015 }
: { path: '/var/run/usbmuxd' };

const CLIENT_VERSION = 'usbmux-client';
const PROG_NAME = 'usbmux-client';

function plistSerialize(value: any) {
const plistString = plist.build(value)
const plistBuffer = Buffer.from(plistString, 'utf8');
Expand Down Expand Up @@ -35,8 +38,8 @@ const swap16bitEndianness = (port: number) => {
function requestTunnelMessage(deviceId: number, port: number) {
return plistSerialize({
MessageType: 'Connect',
ClientVersionString: 'usbmux-client',
ProgName: 'usbmux-client',
ClientVersionString: CLIENT_VERSION,
ProgName: PROG_NAME,
DeviceID: deviceId,
PortNumber: swap16bitEndianness(port)
});
Expand Down Expand Up @@ -188,8 +191,8 @@ export class UsbmuxClient {
// Start listening for connected devices:
conn.write(plistSerialize({
MessageType: 'Listen',
ClientVersionString: 'usbmux-client',
ProgName: 'usbmux-client'
ClientVersionString: CLIENT_VERSION,
ProgName: PROG_NAME
}));

const response = await readPlistMessageFromStream(conn);
Expand Down

0 comments on commit cc9953e

Please sign in to comment.