diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9e77ec..734b769 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,12 +32,12 @@ jobs: id: go - name: Build for ${{ matrix.build.name }} run: | - CGO_ENABLED=0 GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} go build -trimpath -ldflags="-w -s" -o estkme-rlpa-server-${{ matrix.build.os }}-${{ matrix.build.arch }} + CGO_ENABLED=0 GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} go build -trimpath -ldflags="-w -s" -o estkme-cloud-${{ matrix.build.os }}-${{ matrix.build.arch }} - name: Upload ${{ matrix.build.name }} to Artifact uses: actions/upload-artifact@v4 with: - name: estkme-rlpa-server-${{ matrix.build.os }}-${{ matrix.build.arch }} - path: estkme-rlpa-server-${{ matrix.build.os }}-${{ matrix.build.arch }} + name: estkme-cloud-${{ matrix.build.os }}-${{ matrix.build.arch }} + path: estkme-cloud-${{ matrix.build.os }}-${{ matrix.build.arch }} release: name: Release @@ -51,8 +51,8 @@ jobs: uses: actions/download-artifact@v4 with: merge-multiple: true - pattern: '*' + pattern: "*" - name: Release uses: softprops/action-gh-release@v2 with: - files: '*' + files: "*" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5f1d747..dc0e84a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,8 +23,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 @@ -54,7 +54,6 @@ jobs: uses: docker/build-push-action@v5 with: context: . - platforms: linux/amd64 push: ${{ startsWith(github.ref, 'refs/tags/v') }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 9b3f018..fca4038 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,19 +6,19 @@ COPY . . RUN set -ex \ && go mod download \ - && go build -trimpath -ldflags="-w -s" -o estkme-rlpa-server main.go + && go build -trimpath -ldflags="-w -s" -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 e56e262..50cb873 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# eSTK.me Remote LPA Server +# eSTK.me Cloud 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 rLPA server, I recommend you to use the [official 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 server, I recommend you to use the [official eSTK.me cloud server](https://github.com/estkme-group/lpac/blob/main/src/cloud-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 - rLPA server listen address (default ":1888") + eSTK.me cloud 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 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 rLPA server URL 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+` feature on the eUICC and set the eSTK.me cloud server URL 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 85% rename from internal/rlpa/apdu.go rename to internal/cloud/apdu.go index 2a94cf4..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/transmitter" + "github.com/damonto/estkme-cloud/internal/driver" ) type apdu struct { @@ -13,7 +13,7 @@ type apdu struct { receiver chan []byte } -func NewAPDU(conn *Conn) transmitter.APDU { +func NewAPDU(conn *Conn) driver.APDU { return &apdu{conn: conn, receiver: make(chan []byte, 1)} } diff --git a/internal/rlpa/conn.go b/internal/cloud/conn.go similarity index 96% rename from internal/rlpa/conn.go rename to internal/cloud/conn.go index 3120e7c..a1c1b50 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/transmitter" + "github.com/damonto/estkme-cloud/internal/driver" ) type Handler = func(conn *Conn, data []byte) error @@ -16,7 +16,7 @@ type Handler = func(conn *Conn, data []byte) error type Conn struct { Id string Conn *net.TCPConn - APDU transmitter.APDU + APDU driver.APDU lock sync.Mutex isClosed bool handlers map[byte]Handler 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 97% rename from internal/rlpa/server.go rename to internal/cloud/server.go index 42deb20..fb088ca 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("rLPA server is running on", "address", address) + slog.Info("cloud 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/transmitter/apdu.go b/internal/driver/apdu.go similarity index 85% rename from internal/transmitter/apdu.go rename to internal/driver/apdu.go index 12e33a0..ca2f510 100644 --- a/internal/transmitter/apdu.go +++ b/internal/driver/apdu.go @@ -1,4 +1,4 @@ -package transmitter +package driver type APDU interface { Lock() error diff --git a/internal/lpac/cli.go b/internal/lpac/cli.go index 3015c77..9edeffe 100644 --- a/internal/lpac/cli.go +++ b/internal/lpac/cli.go @@ -9,15 +9,15 @@ import ( "path/filepath" "runtime" - "github.com/damonto/estkme-rlpa-server/internal/config" - "github.com/damonto/estkme-rlpa-server/internal/transmitter" + "github.com/damonto/estkme-cloud/internal/config" + "github.com/damonto/estkme-cloud/internal/driver" ) type Cmder struct { - APDU transmitter.APDU + APDU driver.APDU } -func NewCmder(APDU transmitter.APDU) *Cmder { +func NewCmder(APDU driver.APDU) *Cmder { return &Cmder{APDU: APDU} } diff --git a/main.go b/main.go index 6316a6e..25406c4 100644 --- a/main.go +++ b/main.go @@ -7,14 +7,14 @@ 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" ) func init() { cwd, _ := os.Getwd() - flag.StringVar(&config.C.ListenAddress, "listen-address", ":1888", "rLPA server listen address") + flag.StringVar(&config.C.ListenAddress, "listen-address", ":1888", "eSTK.me cloud 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") @@ -34,8 +34,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 {