add client ID

This commit is contained in:
ginuerzh
2023-09-19 22:32:40 +08:00
parent 288089404a
commit 0e42c7c67e
16 changed files with 134 additions and 71 deletions

View File

@ -21,10 +21,14 @@ type server struct {
func (s *server) Bypass(ctx context.Context, in *proto.BypassRequest) (*proto.BypassReply, error) {
reply := &proto.BypassReply{}
if in.GetAddr() == "example.com" {
host := in.GetAddr()
if v, _, _ := net.SplitHostPort(host); v != "" {
host = v
}
if host == "example.com" {
reply.Ok = true
}
log.Printf("bypass: %s, %v", in.GetAddr(), reply.Ok)
log.Printf("bypass(%s): %s, %v", in.GetClient(), in.GetAddr(), reply.Ok)
return reply, nil
}