Skip to content

Commit

Permalink
cli: fix undefined: config.MysqldConfig. (#547)
Browse files Browse the repository at this point in the history
Signed-off-by: CFC4N <[email protected]>
  • Loading branch information
cfc4n committed May 19, 2024
1 parent eb6b35d commit 7a3435c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go-c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ jobs:
make clean
CROSS_ARCH=arm64 make env
CROSS_ARCH=arm64 make -j8
- name: Build non-CO-RE (Cross-Compilation)
- name: Build non-CO-RE (Cross-Compilation/Android)
run: |
make clean
CROSS_ARCH=arm64 make env
CROSS_ARCH=arm64 make nocore -j8
ANDROID=1 CROSS_ARCH=arm64 make nocore -j8
- name: Test
run: go test -v -race ./...

Expand Down
28 changes: 0 additions & 28 deletions cli/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ func NewHttpServer(addr string, confChan chan config.IConfig, zerologger zerolog
return hs
}

func (hs *HttpServer) attach() {
hs.ge.POST("/bash", hs.Bash)
hs.ge.POST("/gnutls", hs.Gnutls)
hs.ge.POST("/gotls", hs.Gotls)
hs.ge.POST("/mysqld", hs.Mysqld)
hs.ge.POST("/nss", hs.Nss)
hs.ge.POST("/nspr", hs.Nss)
hs.ge.POST("/postgress", hs.Postgress)
hs.ge.POST("/tls", hs.Tls)
hs.ge.POST("/openssl", hs.Tls)
hs.ge.POST("/boringssl", hs.Tls)
}

func (hs HttpServer) Run() error {
return hs.ge.Run(hs.addr)
}
Expand All @@ -74,11 +61,6 @@ func (hs *HttpServer) Tls(c *gin.Context) {
return
}

func (hs *HttpServer) Bash(c *gin.Context) {
hs.decodeConf(new(config.BashConfig), c, module.ModuleNameBash)
return
}

func (hs *HttpServer) Gnutls(c *gin.Context) {
hs.decodeConf(new(config.GnutlsConfig), c, module.ModuleNameGnutls)
return
Expand All @@ -89,21 +71,11 @@ func (hs *HttpServer) Gotls(c *gin.Context) {
return
}

func (hs *HttpServer) Mysqld(c *gin.Context) {
hs.decodeConf(new(config.MysqldConfig), c, module.ModuleNameMysqld)
return
}

func (hs *HttpServer) Nss(c *gin.Context) {
hs.decodeConf(new(config.NsprConfig), c, module.ModuleNameNspr)
return
}

func (hs *HttpServer) Postgress(c *gin.Context) {
hs.decodeConf(new(config.PostgresConfig), c, module.ModuleNamePostgres)
return
}

func (hs *HttpServer) decodeConf(ic config.IConfig, c *gin.Context, modName string) {
if err := c.ShouldBindJSON(&ic); err != nil {
c.JSON(http.StatusBadRequest, Resp{
Expand Down
28 changes: 28 additions & 0 deletions cli/http/server_androidgki.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build androidgki
// +build androidgki

// Copyright 2022 CFC4N <[email protected]>. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package http

func (hs *HttpServer) attach() {
hs.ge.POST("/gnutls", hs.Gnutls)
hs.ge.POST("/gotls", hs.Gotls)
hs.ge.POST("/nss", hs.Nss)
hs.ge.POST("/nspr", hs.Nss)
hs.ge.POST("/tls", hs.Tls)
hs.ge.POST("/openssl", hs.Tls)
hs.ge.POST("/boringssl", hs.Tls)
}
52 changes: 52 additions & 0 deletions cli/http/server_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//go:build !androidgki
// +build !androidgki

// Copyright 2022 CFC4N <[email protected]>. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package http

import (
"github.com/gin-gonic/gin"
"github.com/gojue/ecapture/user/config"
"github.com/gojue/ecapture/user/module"
)

func (hs *HttpServer) attach() {
hs.ge.POST("/bash", hs.Bash)
hs.ge.POST("/gnutls", hs.Gnutls)
hs.ge.POST("/gotls", hs.Gotls)
hs.ge.POST("/mysqld", hs.Mysqld)
hs.ge.POST("/nss", hs.Nss)
hs.ge.POST("/nspr", hs.Nss)
hs.ge.POST("/postgress", hs.Postgress)
hs.ge.POST("/tls", hs.Tls)
hs.ge.POST("/openssl", hs.Tls)
hs.ge.POST("/boringssl", hs.Tls)
}

func (hs *HttpServer) Bash(c *gin.Context) {
hs.decodeConf(new(config.BashConfig), c, module.ModuleNameBash)
return
}

func (hs *HttpServer) Mysqld(c *gin.Context) {
hs.decodeConf(new(config.MysqldConfig), c, module.ModuleNameMysqld)
return
}

func (hs *HttpServer) Postgress(c *gin.Context) {
hs.decodeConf(new(config.PostgresConfig), c, module.ModuleNamePostgres)
return
}

0 comments on commit 7a3435c

Please sign in to comment.