A pure Go implementation of PROFINET IO (IEC 61158-5-10/6-10, IEC 61784-2), the industrial Ethernet of PLCs, remote IO, drives and field devices. No cgo, no dependencies outside the standard library.
The library provides:
- An IO-Controller (
controller): finds its devices by station name with DCP, optionally assigns their IP address, establishes an application relationship (AR) in legacy (RT_CLASS_1) or advanced (RT_CLASS_2) startup, writes the parameters, exchanges cyclic IO data, acknowledges alarms, reads and writes records and re-establishes the AR after a failure, one lifecycle per device; device access (supervisor) ARs and ReadImplicit for engineering tools - An IO-Device (
device): DCP responder, LLDP, the RPC server for Connect, Read, Write, Control and Release, the AR state machine (IOCAR and IOSAR, several ARs), cyclic input production and output consumption with watchdogs, process, diagnosis and plug alarms, diagnosis records, I&M0–4, RealIdentificationData, ModuleDiff, port data for the topology, port checks (CheckPeers) and adjustments (LLDP and DCP boundaries), shared device (several controllers, one owner per submodule), multiport devices on a software switch (l2/bridge), media redundancy (MRP client, manager and automatic manager), an opt-in read-only SNMP agent (MIB-II, LLDP-MIB), an opt-in DCP policy (read-only, rate limits, audit) and, as an experiment off by default, system redundancy S2 - DCP (
dcp): Identify with filters and response delay, Get, Set (station name, IP suite, temporary or permanent), Signal, ResetToFactory, Hello (sent by the device, used by the controller to connect without Identify); requester and responder - LLDP (
lldp) with the PROFINET TLVs, an agent and a neighbor table - Connectionless DCE/RPC (
rpc) over anynet.PacketConn: activities, fragmentation and reassembly, at-most-once execution, idempotent calls - The PNIO codecs (
pnio): every block of Connect, Control, Read, Write, alarms, diagnosis, identification, I&M, ModuleDiff and PDPortDataReal; NDR headers and PNIO status - RT cyclic data (
rt): frames, the C_SDU layout of IOCRs, provider, consumer with cycle counter and watchdog, a scheduler with jitter statistics; alarms (alarm): the RTA protocol with sequence numbers, acknowledgement, retransmission and window - GSDML (
gsdml): parsing, validation, encoding and conversion between GSDML files and device models, from a schema catalog by code generation; and a complete model of every GSDML schema version V1.0 to V2.46 (gsdml/typed,gsdml/versions/vNNN), generated from the reference schemas: typed structs, reflection-free codecs, and a validator that checks a file against the schema of its own version with no schema at run time - Layer 2 backends: Linux AF_PACKET, macOS/BSD BPF, Windows Npcap
(
l2/osportpicks the one of the platform) and an in-memory virtual Ethernet (vnet) with seeded faults, plus a small ARP/IPv4/UDP stack (netstack), so that a controller and devices run in one process without privileges - Verified against independent implementations: rt-labs p-net, pnio-rs, profinet-py and pnio-dcp (PROFINET), umrp and microchip-ung/mrp on the Linux kernel's bridge MRP (MRP rings), Net-SNMP (the SNMP agent), with every capture decoded by Wireshark and scapy, in the containers of otfabric/profinet-interop (see INTEROPERABILITY.md and the support, feature and interop matrix, docs/FEATURE-STATUS.md)
- Observability: a
profinet.Metricscallback interface (state changes, connects, aborts, record accesses with durations, alarms, retries), structured logging throughlog/slog, counters on every component, typed errors with sentinels (ERRORS.md, OBSERVABILITY.md); reconnection with exponential backoff and jitter - Persistence and re-parameterization: an optional store keeps a
device's permanent name, address and I&M records across restarts
(
store,device.Config.Store); a controller re-parameterizes a running device (Reparameterize)
A command-line tool on top of it is otfabric/profinetctl.
go-profinet is not certified by PROFIBUS & PROFINET International (PI) and claims no conformance. PROFINET has no security of its own: run it on isolated networks. See SECURITY.md.
Comparison: go-profinet vs other stacks
Docs: API.md (public API) · ARCHITECTURE.md (packages, goroutines, state machines) · INTEROPERABILITY.md (implemented services, conformance and interop matrices) · ERRORS.md · OBSERVABILITY.md · SECURITY.md · LIMITATIONS.md · CONTRIBUTING.md · RELEASE.md · guides in docs/ (controller, device, DCP, LLDP, RPC, cyclic data, diagnostics, GSDML, code generation, testing, coverage, benchmarks)
go-profinet is tested against three of these stacks (see INTEROPERABILITY.md). Each suits different needs; the table shows where they differ, from their public sources, so that you can pick the right one. The PI Community Stack is members-only; its column is from PI's public pages.
| Capability | otfabric/go-profinet | rt-labs p-net | pnio-rs | profinet-py | PI Community Stack |
|---|---|---|---|---|---|
| Language | Go | C | Rust | Python | C |
| Licence | MIT | GPL-3.0-only or commercial | MIT OR Apache-2.0 | GPL-3.0-only or commercial | PNO Community Source Code License (members only; no combination with copyleft) |
| Status | pre-1.0 (v0.24.0, 2026) | maintained privately; public tree is an evaluation snapshot without ports or build files (v2.0.0, 2026) | young, single author (v0.1.0, 2026) | active, one maintainer (0.6.6, 2026) | maintained by PI |
| IO-Controller | ✅ | — | — | ✅ minimal (cyclic marked experimental) | not documented publicly |
| IO-Device | ✅ | ✅ | ✅ | — | ✅ |
| DCP requester | ✅ Identify (all filters), Get, Set, Signal, Reset | — | — | ✅ | — |
| DCP responder | ✅ incl. filters, response delay, Set transactions, Hello | ✅ incl. Hello | ◐ Identify by name or all; no Get, Set name, Signal or Reset | — | ✅ |
| LLDP | ✅ agent and neighbor table | ✅ | — | — (reads PDRealData only) | ✅ |
| RT_CLASS_1 / RT_CLASS_2 (unsynchronized) | ✅ / ✅ | ✅ / ✅ | ◐ RT_CLASS_2 FrameIDs only | ✅ / — | ✅ |
| IRT (RT_CLASS_3) | — | — | — | — | ✅ with a hardware driver |
| Alarms | ✅ both priorities, all types | ✅ | ◐ low priority, diagnosis only | ✅ receive and acknowledge | ✅ |
| Diagnosis records | ✅ serve and read | ✅ | — (invalid index) | ✅ read | ✅ |
| I&M | ✅ I&M0–4 | ✅ I&M0–4 (device only; the application owns the data from v2.0.0) | ◐ I&M0–3 | ✅ read I&M0–15, write I&M1–3 | ✅ |
| Several ARs on a device | ✅ IOCARs + IOSAR | ✅ IOCARs + device access ARs (build-time maxima) | — single AR | n/a | ✅ |
| Shared device (one owner per submodule, hand-over) | ✅ device and controller | ✅ | — | — | ✅ |
| Device access AR (IOSAR) | ✅ both roles | ✅ Device Access (v2.0.0) | — | ✅ | not documented |
| ModuleDiffBlock | ✅ both roles | ✅ (plugs expected modules) | — (mismatch rejects Connect) | ✅ read | ✅ |
| ReadImplicit, WriteMultiple | ✅ / ✅ | ✅ / ✅ | ✅ / ✅ | ✅ / ✅ | ✅ |
| PDPortDataReal / PDRealData (topology) | ✅ serve and decode | ✅ | — | ✅ read | ✅ |
| PDPortDataCheck (CheckPeers) / PDPortDataAdjust (boundaries) | ✅ device and controller | ◐ CheckPeers, PeerToPeerBoundary bit 0 | — | — | ✅ |
| Re-parameterization in Data (PrmBegin) | ✅ device and controller | ✅ PrmBegin/PrmEnd parameter sequences (v2.0.0) | — (refuses PrmBegin) | ✅ controller | ✅ |
| Media redundancy (MRP) | ✅ client, manager, automatic manager (multiport device); 200/500 ms profiles; written timers select the 200/500 ms profile; PDInterfaceMrpDataCheck: the domain check only | ◐ client (v2.0.0, build option) | — | n/a | not documented |
| System redundancy (S2, AR sets) | ◐ experiment, off by default; not tested against a PLC | ✅ AR sets (v2.0.0, build option) | — | — | not documented |
| Dynamic reconfiguration, plug and pull in Data | — | ✅ (v2.0.0) | — | — | not documented |
| Combined Object Container | — | ✅ (v2.0.0) | — | — | not documented |
| PA profile | — | ◐ marked preliminary (v2.0.0) | — | — | not documented |
| Multicast pruning | — | ◐ filtering only (v2.0.0) | — | — | not documented |
| SNMP agent | ✅ v1/v2c, MIB-II, LLDP-MIB | ◐ optional, through Net-SNMP | — | n/a | not documented |
| GSDML | ✅ parse, validate (catalog, and each file's own schema version), generate, model conversion, configurable submodule selection, typed model of V1.0–V2.46 | — static sample GSDML (V2.4); no parser or generator | ◐ generates V2.4 GSDML from its typed device configuration | ◐ parses DAPs, modules and submodules for cyclic IO | — |
| Platforms | Linux, macOS/BSD, Windows (Npcap) | Linux, RTOS ports (not in the public tree) | Linux | Linux | Linux (Raspberry Pi demo) |
| Runs without privileges in tests | ✅ virtual Ethernet in process | — | — | — | — |
| Tested against other stacks in CI | ✅ p-net (the ea5e554 tree, not v2.0.0), pnio-rs, profinet-py, pnio-dcp; umrp and microchip-ung/mrp (MRP); Net-SNMP; scapy and Wireshark decode every capture |
not documented | golden frames from p-net and an S7-1500 | p-net (integration tests) | not documented |
| PI certification | — (not certified) | v2.0.0 release notes: PROFINET Test Bundle 2.46.0.205 passed, with hints | — | — | basis for certified products |
✅ = available · ◐ = partly (the cell says what) · — = not available. For
p-net v2.0.0 (tag public/v2.0.0, 67301c5, November 2026) from its
source and release notes; pnio-rs v0.1.0 and profinet-py 0.6.6 from their
source and documentation (docs/research/STACKS.md)
as of October 2026. The p-net v2.0.0 cells are what its release notes and
source say, not what go-profinet tested: the interop harness
(profinet-interop v0.16.1) still builds p-net ea5e554 (2023, the last
public tree with build files and ports), so every p-net result in
INTEROPERABILITY.md is against that tree. go-profinet's experimental
features (S2) are marked ◐; docs/FEATURE-STATUS.md
gives each feature's evidence. If you spot an inaccuracy, please
open an issue.
go get github.com/otfabric/go-profinetRequires Go 1.26 or later.
| Package | Contents |
|---|---|
profinet (root) |
sentinel errors, logger interfaces |
controller |
IO-Controller, record client, supervisor AR |
device |
IO-Device |
model |
the device model: identity, DAP, slots, modules, submodules, records |
gsdml |
GSDML documents (generated types), validation with severities, model conversion |
gsdml/typed, gsdml/versions/v100 … v246 |
the model of every GSDML schema version, generated from the reference schemas: types, decoder, encoder, validator |
gsdml/gsdx |
a safe inspector of GSDX (OPC) containers |
dcp |
DCP codec, requester (Client), responder |
lldp |
LLDP codec and agent |
rpc |
connectionless DCE/RPC client and server |
pnio |
PNIO blocks, NDR, status, identifiers |
rt |
cyclic frames, layout, provider, consumer, scheduler |
alarm |
RTA alarm transport |
mrp |
MRP frame codec and the ring client, manager and automatic manager (mrp.New) on a switch |
snmp |
read-only SNMPv1/v2c agent: MIB-II system, interfaces, snmp group, LLDP-MIB |
ptcp |
PTCP delay frame codec (DelayReq, DelayRes); no line delay measurement |
ethernet |
Ethernet and VLAN frame codec, MAC addresses |
l2 |
the Port interface and the frame demultiplexer Mux |
l2/bridge |
the learning switch of a multiport device |
l2/afpacket, l2/bpf, l2/npcap, l2/osport |
the operating systems' raw Ethernet backends |
vnet |
virtual Ethernet switch with loss, duplication, corruption, reordering, delay and jitter |
netstack |
ARP, IPv4 and UDP over a l2.Mux |
pcap |
pcap reader and writer |
examples/ |
quickstart, discovery, DCP Hello, alarms, records, topology, observability (slog and metrics), an MRP ring, chaos, GSDML generation and import, the typed GSDML model, GSDX inspection, a device and a controller on a real interface (outputs) |
e2e/ |
end-to-end and chaos tests on vnet; real Layer 2 tests |
interop/ |
the interop suite against profinet-interop (build tag interop) |
network := vnet.New(1)
dn, _ := vnetenv.NewNode(network, 10, "192.168.0.10") // an endpoint with an IP stack
dev, _ := device.New(device.Config{
Model: model, Mux: dn.Mux, StationName: "io-1",
IP: suite("192.168.0.10"), ListenPacket: dn.Stack.ListenPacket,
})
cn, _ := vnetenv.NewNode(network, 1, "192.168.0.1")
ctrl, _ := controller.New(controller.Config{Mux: cn.Mux, ListenPacket: cn.Stack.ListenPacket, StationName: "plc-1"})
io1, _ := ctrl.AddDevice(controller.DeviceConfig{StationName: "io-1", Model: model})
_ = io1.WaitState(ctx, controller.StateRunning)
dev.SetInput(1, 1, []byte("PROFINET"), pnio.IOxSGood)
io1.SetOutput(2, 1, []byte{1, 2, 3, 4}, pnio.IOxSGood)
in, iops, _ := io1.Input(1, 1)The full program is examples/quickstart (all examples with their output):
go run ./examples/quickstart. It needs no privileges.
port, err := osport.Open("eth0", osport.Options{}) // AF_PACKET, BPF or Npcap
if err != nil {
return err // needs CAP_NET_RAW, /dev/bpf* or Npcap
}
defer port.Close()
mux := l2.NewMux(port)
defer mux.Close()
ctrl, err := controller.New(controller.Config{Mux: mux, StationName: "plc-1"}) // the OS's UDP stack
...
dcpc := ctrl.DCP()
devices, err := dcpc.Identify(ctx, dcp.FilterAll(), dcp.IdentifyOptions{Wait: 2 * time.Second})The expected configuration of a device usually comes from its GSDML file:
doc, err := gsdml.Parse(f)
m, err := gsdml.ToModel(doc, "") // the first device access point
d, err := ctrl.AddDevice(controller.DeviceConfig{StationName: "io-rack-1", Model: m})gsdml.ValidateBytes(data) validates the file against the schema of the
version it names first; v246.Parse(data) (package gsdml/versions/v246)
reads a V2.46 file into its typed structs.
A device built with go-profinet describes itself with one:
doc, err := gsdml.FromModel(m, gsdml.GenerateOptions{SupervisorAR: true})
b, err := gsdml.Marshal(doc)
os.WriteFile(gsdml.FileName(m, "", time.Now()), b, 0o644)See the guides: controller, device, DCP, GSDML.
context.Contexton every blocking call; bounded queues and concurrency everywhere; malformed network input is dropped and counted, never a panic (every decoder is fuzzed)- One goroutine per device lifecycle on the controller; reconnect with backoff; watchdogs, data hold and CM activity timeouts as configured
- Typed errors that match the sentinels of the root package (ERRORS.md); PNIO and DCP status codes preserved
- Structured logging through a small
Loggerinterface withlog/slogandlogadapters; counters on every component (OBSERVABILITY.md) - Raw Ethernet on Linux, macOS and Windows; cross-compiles for every
GOOS/GOARCHof the release targets
make check # generate-check, fmt, lint, vet, vuln, test (race), coverage ≥ 90 %, examples
make test-e2e # end-to-end and chaos tests on vnet
make fuzz # every fuzz target for FUZZTIME (30 s)
make bench # codec and cyclic benchmarks
make l2-test # real AF_PACKET tests on a veth pair in a privileged container (Docker)
make interop-images && make interop # the interop suite (Docker), see INTEROPERABILITY.mdThe tests also replay traffic recorded from real equipment, among it the requests of a SIMATIC S7-1500 CPU 1515-2 PN to an IO-Device (testdata/captures): recorded evidence, not a test against a live PLC.
docs/TESTING.md describes the test strategy, docs/COVERAGE.md the coverage per package and docs/BENCHMARKS.md the measured performance.
The features of conformance class A as controller and device (RT_CLASS_1
and RT_CLASS_2 without synchronization), shared device, multiport devices,
MRP (client, manager and automatic manager; no MRPD, no interconnection)
and a read-only SNMP agent; system
redundancy S2 is an experiment that is not interoperable. This is feature
coverage, not conformance: go-profinet is not certified for any class, and
no time measured on the virtual network is a real-time claim. No IRT,
PROFIsafe or PROFINET security classes: Security Class 1 is not
implemented. Two of its capabilities are, the RejectDCPsetRequests flag
and the CIM SNMP records; GSD signing is not
(SECURITY.md). What was built without PI
membership or hardware, how it was verified and what it does not do is in
docs/FEATURE-STATUS.md (the support, feature and
interop matrix), LIMITATIONS.md, the release notes
(RELEASE.md),
docs/research/NEXT-PROGRAM-REPORT.md
and, for the previous round,
docs/research/FEATURE-COMPLETION-REPORT.md. OT Fabric is not a PI
member: what that costs (official XSD validation, GSDX, MRCD, signing,
certification) is listed in docs/PI-MEMBERSHIP.md.
GSDML validation follows
an independent catalog and, for CheckBytes, code generated from the
schemas (checked against libxml2, not PI's checker); GSDX and MRCD are not
implemented (their formats are not public), beyond a generic inspector of
the public OPC container (gsdml/gsdx, signatures not verified). The full list is in
LIMITATIONS.md.
MIT, see LICENSE. The interop suite runs GPL-licensed reference implementations in separate containers; none of their code is part of go-profinet.