Skip to content

Commit

Permalink
export sender props and make them re-usable (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
mutec authored Mar 11, 2024
1 parent bfe007a commit 145f479
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Socket, createSocket } from 'dgram';
import { multicastGroup } from './util';
import { Packet, Options } from './packet';

interface Props {
export interface SenderProps {
universe: number;
port?: number;
reuseAddr?: boolean;
Expand Down Expand Up @@ -33,17 +33,17 @@ interface Props {
export class Sender {
private socket: Socket;

private readonly port: Props['port'];
private readonly port: SenderProps['port'];

public readonly universe: Props['universe'];
public readonly universe: SenderProps['universe'];

/**
* this is normally a multicast address, but it could be
* a unicast address if the user configures `useUnicastDestination`
*/
readonly #destinationIp: string;

private readonly defaultPacketOptions: Props['defaultPacketOptions'];
private readonly defaultPacketOptions: SenderProps['defaultPacketOptions'];

private sequence = 0;

Expand All @@ -64,7 +64,7 @@ export class Sender {
defaultPacketOptions,
iface,
useUnicastDestination,
}: Props) {
}: SenderProps) {
this.port = port;
this.universe = universe;
this.#destinationIp = useUnicastDestination || multicastGroup(universe);
Expand Down

0 comments on commit 145f479

Please sign in to comment.