Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR - udp liveness check updated #284

Merged
merged 1 commit into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions cicd/http2ep/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"crypto/x509"
"flag"
"fmt"
"golang.org/x/net/http2"
"io/ioutil"
"log"
"net/http"
"net/url"
"time"
"golang.org/x/net/http2"
)

func main() {
Expand Down Expand Up @@ -67,29 +67,29 @@ Options:
}

client := http.Client{Transport: t, Timeout: 5 * time.Second}
for i:=1; i <= 2; i++ {
urlStr := "https://" + *host
req, err := http.NewRequest(http.MethodGet, urlStr, nil)
if err != nil {
log.Fatalf("Error creating new http request : %s", err)
}
for i := 1; i <= 2; i++ {
urlStr := "https://" + *host
req, err := http.NewRequest(http.MethodGet, urlStr, nil)
if err != nil {
log.Fatalf("Error creating new http request : %s", err)
}

resp, err := client.Do(req)
if err != nil {
switch e := err.(type) {
case *url.Error:
log.Fatalf("url.Error : %s", e)
default:
log.Fatalf("Unexpected error : %s", err)
resp, err := client.Do(req)
if err != nil {
switch e := err.(type) {
case *url.Error:
log.Fatalf("url.Error : %s", e)
default:
log.Fatalf("Unexpected error : %s", err)
}
}
}

body, err := ioutil.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
log.Fatalf("Error in reading resp: %s", err)
}
body, err := ioutil.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
log.Fatalf("Error in reading resp: %s", err)
}

fmt.Printf("%s ", body)
}
fmt.Printf("%s ", body)
}
}
2 changes: 1 addition & 1 deletion cicd/http2ep/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func main() {
http.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
//log.Printf("Received %s request for host %s from IP address %s",
//req.Method, req.Host, req.RemoteAddr)
resp := fmt.Sprintf("%s:%s",req.Proto,*host)
resp := fmt.Sprintf("%s:%s", req.Proto, *host)
res.Write([]byte(resp))
//log.Printf("OK\n")
})
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ require (
github.com/go-openapi/swag v0.22.3
github.com/go-openapi/validate v0.22.0
github.com/jessevdk/go-flags v1.5.0
github.com/loxilb-io/loxilib v0.8.8-0.20230519082434-55cc3355e0bd
github.com/loxilb-io/loxilib v0.8.8-0.20230522072824-40657d491e9b
github.com/osrg/gobgp/v3 v3.5.0
github.com/prometheus-community/pro-bing v0.1.0
github.com/prometheus/client_model v0.3.0
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
golang.org/x/net v0.7.0
golang.org/x/sys v0.5.0
golang.org/x/net v0.10.0
golang.org/x/sys v0.8.0
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.1
)
Expand Down Expand Up @@ -47,7 +47,7 @@ require (
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
go.mongodb.org/mongo-driver v1.11.6 // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ github.com/loxilb-io/loxilib v0.8.8-0.20230519082402-24b24c6690b0 h1:8sCpSLIPmiH
github.com/loxilb-io/loxilib v0.8.8-0.20230519082402-24b24c6690b0/go.mod h1:uJnuwi6j84k/y/W5xW2mZeskDbMPkyKKAivgCoF4BVI=
github.com/loxilb-io/loxilib v0.8.8-0.20230519082434-55cc3355e0bd h1:/HtPQOSi94+gECrCjRf3KaIlEN0BVWiuGLPzUwRnYDg=
github.com/loxilb-io/loxilib v0.8.8-0.20230519082434-55cc3355e0bd/go.mod h1:uJnuwi6j84k/y/W5xW2mZeskDbMPkyKKAivgCoF4BVI=
github.com/loxilb-io/loxilib v0.8.8-0.20230522063907-5b93551cb626 h1:WlVu07qDqLnwayyds9h7E6/2DJ3Y/CVSlxhuEj1jUiQ=
github.com/loxilb-io/loxilib v0.8.8-0.20230522063907-5b93551cb626/go.mod h1:LoQCxBz+N0fO9rGwRmPHrQPHol/jUf4MNpph63Cydkg=
github.com/loxilb-io/loxilib v0.8.8-0.20230522072540-4ba9ddf4efcf h1:342+g1s7I27Qrc3Z7nXSzdRyaZaeEAyOf+sGnDbMyp0=
github.com/loxilb-io/loxilib v0.8.8-0.20230522072540-4ba9ddf4efcf/go.mod h1:LoQCxBz+N0fO9rGwRmPHrQPHol/jUf4MNpph63Cydkg=
github.com/loxilb-io/loxilib v0.8.8-0.20230522072824-40657d491e9b h1:CWgBppsB/keRY38bqOwObd4+pdc2O2e38zUTIb+kCX8=
github.com/loxilb-io/loxilib v0.8.8-0.20230522072824-40657d491e9b/go.mod h1:LoQCxBz+N0fO9rGwRmPHrQPHol/jUf4MNpph63Cydkg=
github.com/loxilb-io/sctp v0.0.0-20230512061258-63a8bc8f1b80 h1:rYO3BYcHt0ILY0sOeygtpUEEFsNS8KZBTbuEIW2foLk=
github.com/loxilb-io/sctp v0.0.0-20230512061258-63a8bc8f1b80/go.mod h1:1a6hv8ISVQhnW5IVpW9o+OL6BAFlWiVpC0O4d19g+wQ=
github.com/loxilb-io/sctp v0.0.0-20230512152123-70e9c76eb88a h1:ASVCk3Mk5n9fNJYJm1+QF9bsFCHysudzE8sj5nhj5P4=
Expand Down Expand Up @@ -455,6 +461,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -527,6 +535,8 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -540,6 +550,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
4 changes: 4 additions & 0 deletions loxinet/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,10 @@ func (R *RuleH) epCheckNow(ep *epHost) {
sType = "tcp"
} else if ep.opts.probeType == HostProbeConnectUdp {
sType = "udp"
ret, sIP := R.Zone.L3.IfaSelectAny(net.ParseIP(ep.hostName), true)
if ret == 0 {
sHint = sIP.String()
}
} else {
sType = "sctp"
ret, sIP := R.Zone.L3.IfaSelectAny(net.ParseIP(ep.hostName), true)
Expand Down