From e48da4514aa3a5117b8691c9dca4f7dacdc0fcc4 Mon Sep 17 00:00:00 2001 From: Damon To Date: Thu, 4 Apr 2024 12:56:51 +0800 Subject: [PATCH] chore: rename estkme-rlpa-server to estkme-cloud --- .github/workflows/build.yml | 6 ++-- .github/workflows/docker.yml | 4 +-- Dockerfile | 8 ++--- README.md | 42 ++++++++++++------------ go.mod | 2 +- internal/{rlpa => cloud}/apdu.go | 4 +-- internal/{rlpa => cloud}/conn.go | 4 +-- internal/{rlpa => cloud}/constants.go | 2 +- internal/{rlpa => cloud}/download.go | 4 +-- internal/{rlpa => cloud}/manager.go | 2 +- internal/{rlpa => cloud}/notification.go | 4 +-- internal/{rlpa => cloud}/server.go | 4 +-- internal/{rlpa => cloud}/util.go | 2 +- internal/lpac/cli.go | 4 +-- main.go | 14 ++++---- 15 files changed, 53 insertions(+), 53 deletions(-) rename internal/{rlpa => cloud}/apdu.go (91%) rename internal/{rlpa => cloud}/conn.go (97%) rename internal/{rlpa => cloud}/constants.go (97%) rename internal/{rlpa => cloud}/download.go (94%) rename internal/{rlpa => cloud}/manager.go (98%) rename internal/{rlpa => cloud}/notification.go (94%) rename internal/{rlpa => cloud}/server.go (96%) rename internal/{rlpa => cloud}/util.go (89%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab5f471..9ae51b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,12 +35,12 @@ jobs: - name: Build for ${{ matrix.target.name }} run: | VERSION=$(git describe --always --tags --match "v*" --dirty="-dev") - CGO_ENABLED=0 GOOS=${{ matrix.target.os }} GOARCH=${{ matrix.target.arch }} go build -trimpath -ldflags="-w -s -X main.Version=${VERSION}" -o estkme-rlpa-server-${{ matrix.target.os }}-${{ matrix.target.arch }} + CGO_ENABLED=0 GOOS=${{ matrix.target.os }} GOARCH=${{ matrix.target.arch }} go build -trimpath -ldflags="-w -s -X main.Version=${VERSION}" -o estkme-cloud-${{ matrix.target.os }}-${{ matrix.target.arch }} - name: Upload ${{ matrix.target.name }} to Artifact uses: actions/upload-artifact@v4 with: - name: estkme-rlpa-server-${{ matrix.target.os }}-${{ matrix.target.arch }} - path: estkme-rlpa-server-${{ matrix.target.os }}-${{ matrix.target.arch }} + name: estkme-cloud-${{ matrix.target.os }}-${{ matrix.target.arch }} + path: estkme-cloud-${{ matrix.target.os }}-${{ matrix.target.arch }} release: name: Release diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 950a850..1326687 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,8 +25,8 @@ jobs: uses: docker/metadata-action@v5 with: images: | - ${{ github.repository_owner }}/estkme-rlpa-server - ghcr.io/${{ github.repository_owner }}/estkme-rlpa-server + ${{ github.repository_owner }}/estkme-cloud + ghcr.io/${{ github.repository_owner }}/estkme-cloud tags: | type=schedule type=ref,event=branch diff --git a/Dockerfile b/Dockerfile index 4392303..9846d57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,19 +7,19 @@ COPY . . ARG VERSION RUN set -ex \ - && CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X main.Version=${VERSION}" -o estkme-rlpa-server main.go + && CGO_ENABLED=0 go build -trimpath -ldflags="-w -s -X main.Version=${VERSION}" -o estkme-cloud main.go FROM alpine:latest WORKDIR /app -COPY --from=builder /app/estkme-rlpa-server /app/estkme-rlpa-server +COPY --from=builder /app/estkme-cloud /app/estkme-cloud RUN set -ex \ && apk add --no-cache gcompat ca-certificates pcsc-lite-libs libcurl \ && update-ca-certificates \ - && chmod +x /app/estkme-rlpa-server + && chmod +x /app/estkme-cloud EXPOSE 1888 -CMD ["/app/estkme-rlpa-server"] +CMD ["/app/estkme-cloud"] diff --git a/README.md b/README.md index a352c2b..6cf7f96 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# eSTK.me rLPA Server +# eSTK.me Cloud Enhance Server ### Introduction @@ -6,29 +6,29 @@ This is a simple server designed to handle requests from the eSTK.me removable e The project is written in Go and is just a toy project, not suitable for production use. -If you want to deploy your own eSTK.me rLPA server, I recommend you to use the [official eSTK.me rLPA server](https://github.com/estkme-group/lpac/blob/main/src/rlpa-server.php) instead. +If you want to deploy your own eSTK.me Cloud Enhance server, I recommend you to use the [official eSTK.me Cloud Enhance server](https://github.com/estkme-group/lpac/blob/main/src/rlpa-server.php) instead. ### Installation -You can download the binary release from the [releases page](https://github.com/damonto/estkme-rlpa-server/releases) or you can build it yourself. +You can download the binary release from the [releases page](https://github.com/damonto/estkme-cloud/releases) or you can build it yourself. If you want to build it yourself, you can run the following commands: ```bash -git clone git@github.com:damonto/estkme-rlpa-server.git -cd estkme-rlpa-server -go build -trimpath -ldflags="-w -s" -o estkme-rlpa-server main.go +git clone git@github.com:damonto/estkme-cloud.git +cd estkme-cloud +go build -trimpath -ldflags="-w -s" -o estkme-cloud main.go ``` You can also install the latest version using the following command: ```bash -go install github.com/damonto/estkme-rlpa-server@latest +go install github.com/damonto/estkme-cloud@latest ``` Sometimes, you might need to set executable permissions for the binary file using the following command: ```bash -chmod +x estkme-rlpa-server +chmod +x estkme-cloud ``` You must also install the following dependencies: @@ -43,19 +43,19 @@ pacman -S pcsclite Once done, you can run the server using the following command: ```bash -./estkme-rlpa-server +./estkme-cloud ``` If you want to change the default port, lpac version or data directory, you can use the following flags: ```plaintext -./estkme-rlpa-server --help +./estkme-cloud --help -Usage of estkme-rlpa-server: +Usage of estkme-cloud: -data-dir string - data directory (default "/home/user/workspace/estkme-rlpa-server/data") + data directory (default "/home/user/workspace/estkme-cloud/data") -listen-address string - eSTK.me rlpa server listen address (default ":1888") + eSTK.me cloud enhance server listen address (default ":1888") -lpac-version string lpac version (default "v2.0.0-beta.1") -dont-download @@ -64,18 +64,18 @@ Usage of estkme-rlpa-server: If you wish to run the program in the background, you can utilize the systemctl command. Here is an example of how to achieve this: -1. Start by creating a service file in the /etc/systemd/system directory. For instance, you can name the file estkme-rlpa-server.service and include the following content: +1. Start by creating a service file in the /etc/systemd/system directory. For instance, you can name the file estkme-cloud.service and include the following content: ```plaintext [Unit] -Description=eSTK.me rLPA Server +Description=eSTK.me Cloud Enhance Server After=network.target [Service] Type=simple User=your_user_here Restart=on-failure -ExecStart=/your/binary/path/here/estkme-rlpa-server +ExecStart=/your/binary/path/here/estkme-cloud RestartSec=10s TimeoutStopSec=30s @@ -85,13 +85,13 @@ WantedBy=multi-user.target 2. Then, use the following command to start the service: ```bash -systemctl start estkme-rlpa-server +systemctl start estkme-cloud ``` 3. If you want the service to start automatically upon system boot, use the following command: ```bash -systemctl enable estkme-rlpa-server +systemctl enable estkme-cloud ``` #### Docker @@ -99,9 +99,9 @@ systemctl enable estkme-rlpa-server You can also run the server using Docker. You can use the following command to run the server: ```bash -docker run -d --name estkme-rlpa-server -p 1888:1888 damonto/estkme-rlpa-server:latest +docker run -d --name estkme-cloud -p 1888:1888 damonto/estkme-cloud:latest # or use the GitHub Container Registry -docker run -d --name estkme-rlpa-server -p 1888:1888 -v ghcr.io/damonto/estkme-rlpa-server:latest +docker run -d --name estkme-cloud -p 1888:1888 -v ghcr.io/damonto/estkme-cloud:latest ``` ### Usage @@ -110,7 +110,7 @@ Once the server is running, the server will listen on the specified port (defaul #### Download -To download a profile, you should enable the `Remote LPA` feature on the eUICC and set the server listening address to the server address. The server will handle the download request and download the profile to the eUICC. +To download a profile, you should enable the `Cloud Enhance` feature on the eUICC and set the server listening address to the server address. The server will handle the download request and download the profile to the eUICC. The server support downloading profiles with confirmation code and custom IMEI. diff --git a/go.mod b/go.mod index 790ffe3..ad0441a 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/damonto/estkme-rlpa-server +module github.com/damonto/estkme-cloud go 1.22.1 diff --git a/internal/rlpa/apdu.go b/internal/cloud/apdu.go similarity index 91% rename from internal/rlpa/apdu.go rename to internal/cloud/apdu.go index b531b03..836bcee 100644 --- a/internal/rlpa/apdu.go +++ b/internal/cloud/apdu.go @@ -1,10 +1,10 @@ -package rlpa +package cloud import ( "encoding/hex" "sync" - "github.com/damonto/estkme-rlpa-server/internal/driver" + "github.com/damonto/estkme-cloud/internal/driver" ) type apdu struct { diff --git a/internal/rlpa/conn.go b/internal/cloud/conn.go similarity index 97% rename from internal/rlpa/conn.go rename to internal/cloud/conn.go index afa80dc..bb6920a 100644 --- a/internal/rlpa/conn.go +++ b/internal/cloud/conn.go @@ -1,4 +1,4 @@ -package rlpa +package cloud import ( "encoding/binary" @@ -8,7 +8,7 @@ import ( "net" "sync" - "github.com/damonto/estkme-rlpa-server/internal/driver" + "github.com/damonto/estkme-cloud/internal/driver" ) type Handler = func(conn *Conn, data []byte) error diff --git a/internal/rlpa/constants.go b/internal/cloud/constants.go similarity index 97% rename from internal/rlpa/constants.go rename to internal/cloud/constants.go index 7a5b790..dd0a413 100644 --- a/internal/rlpa/constants.go +++ b/internal/cloud/constants.go @@ -1,4 +1,4 @@ -package rlpa +package cloud const ( TagMessageBox = 0x00 diff --git a/internal/rlpa/download.go b/internal/cloud/download.go similarity index 94% rename from internal/rlpa/download.go rename to internal/cloud/download.go index 65a13b7..1c71da6 100644 --- a/internal/rlpa/download.go +++ b/internal/cloud/download.go @@ -1,10 +1,10 @@ -package rlpa +package cloud import ( "bytes" "errors" - "github.com/damonto/estkme-rlpa-server/internal/lpac" + "github.com/damonto/estkme-cloud/internal/lpac" ) const ( diff --git a/internal/rlpa/manager.go b/internal/cloud/manager.go similarity index 98% rename from internal/rlpa/manager.go rename to internal/cloud/manager.go index 82939d9..b31d3fb 100644 --- a/internal/rlpa/manager.go +++ b/internal/cloud/manager.go @@ -1,4 +1,4 @@ -package rlpa +package cloud import ( "errors" diff --git a/internal/rlpa/notification.go b/internal/cloud/notification.go similarity index 94% rename from internal/rlpa/notification.go rename to internal/cloud/notification.go index 71c9b55..cae3b51 100644 --- a/internal/rlpa/notification.go +++ b/internal/cloud/notification.go @@ -1,10 +1,10 @@ -package rlpa +package cloud import ( "fmt" "log/slog" - "github.com/damonto/estkme-rlpa-server/internal/lpac" + "github.com/damonto/estkme-cloud/internal/lpac" ) func processNotification(conn *Conn) error { diff --git a/internal/rlpa/server.go b/internal/cloud/server.go similarity index 96% rename from internal/rlpa/server.go rename to internal/cloud/server.go index 3db1b11..f586460 100644 --- a/internal/rlpa/server.go +++ b/internal/cloud/server.go @@ -1,4 +1,4 @@ -package rlpa +package cloud import ( "encoding/hex" @@ -34,7 +34,7 @@ func (s *server) Listen(address string) error { if err != nil { return err } - slog.Info("eSTK.me rlpa server is running on", "address", address) + slog.Info("eSTK.me cloud enhance server is running on", "address", address) for { conn, err := s.listener.AcceptTCP() diff --git a/internal/rlpa/util.go b/internal/cloud/util.go similarity index 89% rename from internal/rlpa/util.go rename to internal/cloud/util.go index 437c1f4..2806d6b 100644 --- a/internal/rlpa/util.go +++ b/internal/cloud/util.go @@ -1,4 +1,4 @@ -package rlpa +package cloud import "unicode" diff --git a/internal/lpac/cli.go b/internal/lpac/cli.go index 390b424..9edeffe 100644 --- a/internal/lpac/cli.go +++ b/internal/lpac/cli.go @@ -9,8 +9,8 @@ import ( "path/filepath" "runtime" - "github.com/damonto/estkme-rlpa-server/internal/config" - "github.com/damonto/estkme-rlpa-server/internal/driver" + "github.com/damonto/estkme-cloud/internal/config" + "github.com/damonto/estkme-cloud/internal/driver" ) type Cmder struct { diff --git a/main.go b/main.go index a7692a7..e73b122 100644 --- a/main.go +++ b/main.go @@ -7,16 +7,16 @@ import ( "os/signal" "path/filepath" - "github.com/damonto/estkme-rlpa-server/internal/config" - "github.com/damonto/estkme-rlpa-server/internal/lpac" - "github.com/damonto/estkme-rlpa-server/internal/rlpa" + "github.com/damonto/estkme-cloud/internal/cloud" + "github.com/damonto/estkme-cloud/internal/config" + "github.com/damonto/estkme-cloud/internal/lpac" ) var Version string func init() { cwd, _ := os.Getwd() - flag.StringVar(&config.C.ListenAddress, "listen-address", ":1888", "eSTK.me rLPA server listen address") + flag.StringVar(&config.C.ListenAddress, "listen-address", ":1888", "eSTK.me cloud enhance server listen address") flag.StringVar(&config.C.DataDir, "data-dir", filepath.Join(cwd, "data"), "data directory") flag.StringVar(&config.C.LpacVersion, "lpac-version", "v2.0.0", "lpac version") flag.BoolVar(&config.C.DontDownload, "dont-download", false, "don't download lpac") @@ -24,7 +24,7 @@ func init() { } func main() { - slog.Info("eSTK.me rlpa server", "version", Version) + slog.Info("eSTK.me cloud enhance server", "version", Version) config.C.LoadEnv() if err := config.C.IsValid(); err != nil { slog.Error("invalid configuration", "error", err) @@ -38,8 +38,8 @@ func main() { } } - manager := rlpa.NewManager() - server := rlpa.NewServer(manager) + manager := cloud.NewManager() + server := cloud.NewServer(manager) go func() { if err := server.Listen(config.C.ListenAddress); err != nil {