Skip to content

Commit

Permalink
fix(lksh): ipv4 ejudge client
Browse files Browse the repository at this point in the history
  • Loading branch information
Gornak40 committed Jul 31, 2024
1 parent c4f2020 commit 13153ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ejudge/ejudge.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package ejudge

import (
"context"
"errors"
"fmt"
"net"
"net/http"
"net/http/cookiejar"
"net/url"
Expand Down Expand Up @@ -49,11 +51,17 @@ type Ejudge struct {
func NewEjudge(cfg *Config) *Ejudge {
logrus.WithField("url", cfg.URL).Info("init ejudge engine")
jar, _ := cookiejar.New(nil)
trans := &http.Transport{
DialContext: func(_ context.Context, _, addr string) (net.Conn, error) {
return net.Dial("tcp4", addr)
},
}

return &Ejudge{
cfg: cfg,
client: &http.Client{
Jar: jar,
Jar: jar,
Transport: trans,
},
}
}
Expand Down

0 comments on commit 13153ca

Please sign in to comment.