Skip to content

Commit

Permalink
Fix: 修改成员可见性
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninohana committed Sep 18, 2024
1 parent 05bce12 commit 9245b52
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lcu.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Lcu struct {
Client *http.Client
Port string
Auth BasicAuth
authTransport AuthTransport
authTransport authTransport
websocket lcuWebsocket
}

Expand Down Expand Up @@ -55,7 +55,7 @@ func NewLcuClient(port string, auth BasicAuth) *Lcu {
lcu := new(Lcu)
lcu.Port = port
lcu.Auth = auth
lcu.authTransport = AuthTransport{
lcu.authTransport = authTransport{
&localTransport{
&http.Transport{
TLSClientConfig: &tls.Config{
Expand Down
14 changes: 7 additions & 7 deletions my.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

const remain = "Go!!!!!!!!!"

type ErrorResponse struct {
type errorResponse struct {
ErrorCode string `json:"errorCode"`
HttpStatus int `json:"httpStatus"`
ImplementationDetails interface{} `json:"implementationDetails"`
Expand All @@ -23,17 +23,17 @@ type authSetter interface {
setAuth(*http.Request)
}

type AuthTransport struct {
type authTransport struct {
http.RoundTripper
authSetter
}

func (at AuthTransport) RoundTrip(req *http.Request) (*http.Response, error) {
func (at authTransport) RoundTrip(req *http.Request) (*http.Response, error) {
at.setAuth(req)
return at.RoundTripper.RoundTrip(req)
}

func httpGet(client *http.Client, url string) ([]byte, *ErrorResponse) {
func httpGet(client *http.Client, url string) ([]byte, *errorResponse) {
req, _ := http.NewRequest("GET", url, nil)
resp, err := client.Do(req)
if resp == nil {
Expand All @@ -44,14 +44,14 @@ func httpGet(client *http.Client, url string) ([]byte, *ErrorResponse) {
}(resp.Body)
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode < 200 || resp.StatusCode > 299 {
errRes := &ErrorResponse{}
errRes := &errorResponse{}
_ = json.Unmarshal(body, errRes)
return nil, errRes
}
return body, nil
}

func httpPost(client *http.Client, url string, payload map[string]interface{}) ([]byte, *ErrorResponse) {
func httpPost(client *http.Client, url string, payload map[string]interface{}) ([]byte, *errorResponse) {
payloadBytes, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payloadBytes))
resp, err := client.Do(req)
Expand All @@ -63,7 +63,7 @@ func httpPost(client *http.Client, url string, payload map[string]interface{}) (
}(resp.Body)
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode < 200 || resp.StatusCode > 299 {
errRes := &ErrorResponse{}
errRes := &errorResponse{}
_ = json.Unmarshal(body, errRes)
return nil, errRes
}
Expand Down
2 changes: 1 addition & 1 deletion sgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewSgpClient(accessToken string, region Region) *Sgp {
sgp.Region = region
sgp.Auth = OAuth{accessToken}
sgp.Client = &http.Client{
Transport: AuthTransport{
Transport: authTransport{
&http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true, // 跳过证书验证
Expand Down

0 comments on commit 9245b52

Please sign in to comment.