github.com/ronaksoft/rony@v0.16.26-0.20230807065236-1743dbfe6959/internal/gateway/tcp/listener_windows.go (about) 1 //go:build windows 2 // +build windows 3 4 package tcpGateway 5 6 import ( 7 "net" 8 ) 9 10 /* 11 Creation Time: 2021 - Mar - 04 12 Created by: (ehsan) 13 Maintainers: 14 1. Ehsan N. Moosa (E2) 15 Auditor: Ehsan N. Moosa (E2) 16 Copyright Ronak Software Group 2020 17 */ 18 19 type wrapListener struct { 20 l net.Listener 21 } 22 23 func (w *wrapListener) Accept() (net.Conn, error) { 24 c, err := w.l.Accept() 25 if err != nil { 26 return nil, err 27 } 28 return acquireWrapConn(c), nil 29 } 30 31 func (w *wrapListener) Close() error { 32 return w.l.Close() 33 } 34 35 func (w *wrapListener) Addr() net.Addr { 36 return w.l.Addr() 37 } 38 39 func newWrapListener(listenOn string) (wl *wrapListener, err error) { 40 wl = &wrapListener{} 41 wl.l, err = net.Listen("tcp4", listenOn) 42 return 43 }