mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
proxy: support server mode of PROXY protocol v1
This commit is contained in:
1 parent
32e1c37cfe
commit
7486373821
15 files changed
+173
-37
No files matched your search
+3
-3
@@ -1,12 +1,12 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nadoo/glider/pool"
|
||||
@@ -71,12 +71,12 @@ func (c *httpChecker) Check(dialer proxy.Dialer) (time.Duration, error) {
|
||||
r := pool.GetBufReader(rc)
|
||||
defer pool.PutBufReader(r)
|
||||
|
||||
line, _, err := r.ReadLine()
|
||||
line, err := r.ReadString('\n')
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if !bytes.Contains(line, []byte(c.expect)) {
|
||||
if !strings.Contains(line, c.expect) {
|
||||
return 0, fmt.Errorf("expect: %s, got: %s", c.expect, line)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user