Skip to content

feat(connection): add cross-platform TCP, file, and buffer connectors - #171

Merged
adcondev merged 2 commits into
masterfrom
feat/cross-platform-connectors
Oct 18, 2026
Merged

adcondev merged 2 commits into
masterfrom
feat/cross-platform-connectors

Conversation

@adcondev

Copy link
Copy Markdown
Owner

Summary (Area 3 / Phase 4)

  • Cross-Platform Transport Connectors (pkg/connection):
    • TCPConnector: Pure-Go raw socket connector (default port :9100, configurable dial/write timeouts, TCP keep-alive).
    • FileConnector: Cross-platform raw ESC/POS file writer (.bin, .prn) and device stream (/dev/usb/lp0).
    • BufferConnector: Thread-safe in-memory Connector (Bytes(), String(), Len(), Reset()).
  • Platform-Agnostic Printer Filtering (pkg/connection/printer_filter.go): Extract FilterThermalPrinters, FilterPhysicalPrinters, detectPrinterType, and interpretStatus out of //go:build windows with cross-platform unit tests.
  • Cross-Platform CLI Execution (cmd/poster): Wire -t tcp -p <host:port> and -t file -output <path> across Windows, Linux, and macOS.

@adcondev
adcondev merged commit f20d295 into master Oct 18, 2026
@adcondev
adcondev deleted the feat/cross-platform-connectors branch October 18, 2026 19:13
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for opening this PR, @adcondev!

Here's what will happen next:

  • 🤖 Automated checks will run
  • 🏷️ Labels will be added automatically
  • 👀 A maintainer will review your changes

Please make sure:

  • ✅ All tests pass
  • 📝 The PR title follows conventional commits
  • 📋 The PR template is filled out completely

@github-actions

Copy link
Copy Markdown
Contributor

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Benchmark Results

📈 Performance Comparison

📊 Click to expand detailed results

Current Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3123 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3568362	       342.2 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  364603	      3080 ns/op	    1856 B/op	      29 allocs/op
BenchmarkToJSON-4         	  544810	      2087 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  518156	      2258 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   94250	     12660 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  422844	      2703 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  274418	      4224 ns/op	     952 B/op	      22 allocs/op
BenchmarkTextCommandParsing-4       	  536328	      2114 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  244742	      4934 ns/op	    1000 B/op	      31 allocs/op
BenchmarkParseHexString-4           	 8575390	       138.5 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 7355882	       161.6 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	363808773	         3.228 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	37047638	        38.91 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14507427	        85.53 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  496650	      2455 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  134989	      8735 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     558	   2022141 ns/op	 3469937 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     304	   3913920 ns/op	 5481085 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     134	   8680996 ns/op	 5231192 B/op	  230423 allocs/op

Base Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3127 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3560978	       335.1 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  381655	      2946 ns/op	    1856 B/op	      29 allocs/op
BenchmarkToJSON-4         	  539508	      2077 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  491506	      2407 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   90213	     13036 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  406378	      2851 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  268272	      4357 ns/op	     952 B/op	      22 allocs/op
BenchmarkTextCommandParsing-4       	  504758	      2218 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  235273	      4963 ns/op	    1000 B/op	      31 allocs/op
BenchmarkParseHexString-4           	 6724854	       175.5 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 6251659	       190.4 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	296022097	         4.062 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	31882365	        37.06 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14505510	        82.92 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  491912	      2439 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  136515	      8675 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     604	   2038680 ns/op	 3469939 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     320	   3800866 ns/op	 5481085 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     136	   9107476 ns/op	 5231179 B/op	  230423 allocs/op

💡 Note: Use benchstat for statistical comparison

🎯 Summary

  • Total Benchmarks: 32
  • Average Speed: 2665744 ns/op
  • Average Memory: 2396769 B/op
  • Average Allocations: 41077 allocs/op

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant