(tcp *proxyproto.Listener, wg *sync.WaitGroup)
| 107 | } |
| 108 | |
| 109 | func StartPP(tcp *proxyproto.Listener, wg *sync.WaitGroup) { |
| 110 | defer wg.Done() |
| 111 | |
| 112 | if tcp == nil { |
| 113 | log.Print("Exiting pp tcp") |
| 114 | return |
| 115 | } |
| 116 | |
| 117 | defer tcp.Close() |
| 118 | |
| 119 | for { |
| 120 | if conn, err := tcp.Accept(); err == nil { |
| 121 | if _, ok := accept(conn); !ok { |
| 122 | log.Print("cannot accept conn") |
| 123 | } |
| 124 | } else { |
| 125 | log.Print("handle pp tcp err") |
| 126 | if errors.Is(err, net.ErrClosed) { |
| 127 | log.Print(err) |
| 128 | return |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | // ref: github.com/thrawn01/h2c-golang-example |
| 135 | func StartPPWithDoHCleartext(tcp *proxyproto.Listener, doh DohResolver, wg *sync.WaitGroup) { |
no test coverage detected