# gaoxingliang/mac-address-detector-java architecture

> Architecture diagram of the GitHub repository gaoxingliang/mac-address-detector-java, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gaoxingliang/mac-address-detector-java
- Repository: https://github.com/gaoxingliang/mac-address-detector-java

## Overview

This Java library resolves a remote host’s MAC address on the local subnet: callers provide an IP address, and the helper selects an interface, sends an IPv4 ARP or IPv6 neighbor-discovery probe, and returns a captured link-layer address. The README also documents a separate packet-capture-and-dump utility. Helper excerpts are incomplete, so the graph shows only the documented protocol behavior and visible capture/send flow; it omits uncertain internal details.

Main entry points: [`src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java`](https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java) (MAC address helper), [`src/main/java/io/gitee/gaoxingliang/macdetector/PacketDump.java`](https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/PacketDump.java) (Packet dump utility)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lookup["MAC lookup"]
  node_helper["MAC address helper"]
  node_interfaces["Local interfaces"]
  node_probe["ARP / NDP probe"]
  node_listener["Packet response listener"]
end

subgraph group_capture["Packet capture"]
  node_dump["Packet dump utility<br/>[PacketDump.java]"]
  node_dumpfile["PCAP dump file"]
end

subgraph group_native["Capture runtime"]
  node_pcap["Pcap4J / libpcap"]
end

node_caller(("Library caller"))
node_remote(("Remote subnet host"))

node_caller -->|"requests MAC"| node_helper
node_helper -->|"selects interface"| node_interfaces
node_helper -->|"builds probe"| node_probe
node_probe -->|"sends packet"| node_pcap
node_pcap -->|"delivers probe"| node_remote
node_remote -->|"returns response"| node_pcap
node_pcap -->|"dispatches packet"| node_listener
node_listener -->|"provides MAC"| node_helper
node_helper -->|"returns address"| node_caller
node_caller -->|"runs capture"| node_dump
node_dump -->|"captures packets"| node_pcap
node_dump -->|"writes packets"| node_dumpfile

click node_helper "https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java"
click node_interfaces "https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java"
click node_probe "https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java"
click node_listener "https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java"
click node_dump "https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/PacketDump.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_helper,node_interfaces,node_probe,node_listener toneBlue
class node_dump,node_dumpfile toneAmber
class node_pcap toneMint
class node_caller,node_remote toneIndigo
```

## Components

### MAC lookup

- [MAC address helper](https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java): `src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java`
- [Local interfaces](https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java): `src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java`
- [ARP / NDP probe](https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java): `src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java`
- [Packet response listener](https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java): `src/main/java/io/gitee/gaoxingliang/macdetector/MacAddressHelper.java`

### Packet capture

- [Packet dump utility](https://github.com/gaoxingliang/mac-address-detector-java/blob/master/src/main/java/io/gitee/gaoxingliang/macdetector/PacketDump.java): `src/main/java/io/gitee/gaoxingliang/macdetector/PacketDump.java`
- **PCAP dump file**

### Capture runtime

- **Pcap4J / libpcap**

### Other components

- **Library caller**
- **Remote subnet host**

## Connections

- Library caller → MAC address helper: requests MAC
- MAC address helper → Local interfaces: selects interface
- MAC address helper → ARP / NDP probe: builds probe
- ARP / NDP probe → Pcap4J / libpcap: sends packet
- Pcap4J / libpcap → Remote subnet host: delivers probe
- Remote subnet host → Pcap4J / libpcap: returns response
- Pcap4J / libpcap → Packet response listener: dispatches packet
- Packet response listener → MAC address helper: provides MAC
- MAC address helper → Library caller: returns address
- Library caller → Packet dump utility: runs capture
- Packet dump utility → Pcap4J / libpcap: captures packets
- Packet dump utility → PCAP dump file: writes packets
