diff --git a/examples/system.yaml b/examples/system.yaml index 845ef3ba..6d82c924 100644 --- a/examples/system.yaml +++ b/examples/system.yaml @@ -277,7 +277,7 @@ - kind: block name: specs_watch specs: - - kind: gateway + - kind: upgrader name: websocket protocol: websocket @@ -477,7 +477,7 @@ - kind: block name: values_watch specs: - - kind: gateway + - kind: upgrader name: websocket protocol: websocket diff --git a/examples/wsproxy.yaml b/examples/wsproxy.yaml index 027db0bb..f6470a3e 100644 --- a/examples/wsproxy.yaml +++ b/examples/wsproxy.yaml @@ -27,13 +27,13 @@ port: out[0] ports: out[0]: - - name: gateway + - name: upgrader port: io - name: proxy port: io -- kind: gateway - name: gateway +- kind: upgrader + name: upgrader protocol: websocket ports: out: @@ -45,5 +45,5 @@ url: wss://echo.websocket.org/ ports: out: - - name: gateway + - name: upgrader port: in diff --git a/ext/README.md b/ext/README.md index 301242d5..67b6b2d4 100644 --- a/ext/README.md +++ b/ext/README.md @@ -43,7 +43,7 @@ Facilitates smooth execution of network-related tasks across various protocols. - **[HTTP Node](./docs/http_node.md)**: Processes HTTP requests and returns responses, suitable for web service communication. - **[WebSocket Node](./docs/websocket_node.md)**: Establishes WebSocket connections and handles message sending and receiving. -- **[Gateway Node](./docs/gateway_node.md)**: Upgrades HTTP connections to WebSocket for real-time data communication. +- **[Upgrade Node](./docs/upgrade_node.md)**: Upgrades HTTP connections to WebSocket for real-time data communication. - **[Listener Node](./docs/listener_node.md)**: Receives network requests on specified protocols and ports. - **[Router Node](./docs/router_node.md)**: Routes input packets to multiple output ports based on conditions. diff --git a/ext/README_kr.md b/ext/README_kr.md index 1711bf36..864632b3 100644 --- a/ext/README_kr.md +++ b/ext/README_kr.md @@ -40,7 +40,7 @@ - **[HTTP 노드](./docs/http_node_kr.md)**: HTTP 요청을 처리하고 응답을 반환하여 웹 서비스와 통신합니다. - **[WebSocket 노드](./docs/websocket_node_kr.md)**: WebSocket 연결을 설정하고 메시지를 송수신합니다. -- **[Gateway 노드](./docs/gateway_node_kr.md)**: HTTP 연결을 WebSocket으로 업그레이드하여 실시간 데이터 통신을 지원합니다. +- **[Upgrade 노드](./docs/upgrade_node_kr.md)**: HTTP 연결을 WebSocket으로 업그레이드하여 실시간 데이터 통신을 지원합니다. - **[Listener 노드](./docs/listener_node_kr.md)**: 지정된 프로토콜과 포트에서 네트워크 요청을 수신합니다. - **[Router 노드](./docs/router_node_kr.md)**: 입력 패킷을 조건에 따라 여러 출력 포트로 라우팅합니다. diff --git a/ext/docs/gateway_node.md b/ext/docs/upgrader_node.md similarity index 85% rename from ext/docs/gateway_node.md rename to ext/docs/upgrader_node.md index cb62ce67..f66908a5 100644 --- a/ext/docs/gateway_node.md +++ b/ext/docs/upgrader_node.md @@ -1,6 +1,7 @@ -# Gateway Node +# Upgrade Node -**The Gateway Node** provides the capability to upgrade network protocols to other protocols, primarily converting HTTP connections to WebSocket connections to support real-time data communication. +**The Upgrade Node** provides the capability to upgrade network protocols to other protocols, primarily converting HTTP +connections to WebSocket connections to support real-time data communication. ## Specification @@ -47,13 +48,13 @@ port: out[0] ports: out[0]: - - name: gateway + - name: upgrader port: io - name: proxy port: io -- kind: gateway - name: gateway +- kind: upgrader + name: upgrader protocol: websocket ports: out: @@ -65,6 +66,6 @@ url: wss://echo.websocket.org/ ports: out: - - name: gateway + - name: upgrader port: in ``` diff --git a/ext/docs/gateway_node_kr.md b/ext/docs/upgrader_node_kr.md similarity index 92% rename from ext/docs/gateway_node_kr.md rename to ext/docs/upgrader_node_kr.md index e5c79712..40d82149 100644 --- a/ext/docs/gateway_node_kr.md +++ b/ext/docs/upgrader_node_kr.md @@ -1,6 +1,6 @@ -# Gateway 노드 +# Upgrade 노드 -**Gateway 노드**는 네트워크 프로토콜을 다른 프로토콜로 업그레이드하는 기능을 제공하며, 주로 HTTP 연결을 WebSocket 연결로 변환하여 실시간 데이터 통신을 지원합니다. +**Upgrade 노드**는 네트워크 프로토콜을 다른 프로토콜로 업그레이드하는 기능을 제공하며, 주로 HTTP 연결을 WebSocket 연결로 변환하여 실시간 데이터 통신을 지원합니다. ## 명세 @@ -47,13 +47,13 @@ port: out[0] ports: out[0]: - - name: gateway + - name: upgrader port: io - name: proxy port: io -- kind: gateway - name: gateway +- kind: upgrader + name: upgrader protocol: websocket ports: out: @@ -65,6 +65,6 @@ url: wss://echo.websocket.org/ ports: out: - - name: gateway + - name: upgrader port: in ``` diff --git a/ext/docs/websocket_node.md b/ext/docs/websocket_node.md index cea8efcb..ac283189 100644 --- a/ext/docs/websocket_node.md +++ b/ext/docs/websocket_node.md @@ -41,13 +41,13 @@ port: out[0] ports: out[0]: - - name: gateway + - name: upgrader port: io - name: proxy port: io -- kind: gateway - name: gateway +- kind: upgrader + name: upgrader protocol: websocket ports: out: @@ -59,6 +59,6 @@ url: wss://echo.websocket.org/ ports: out: - - name: gateway + - name: upgrader port: in ``` diff --git a/ext/docs/websocket_node_kr.md b/ext/docs/websocket_node_kr.md index bd7997fe..f36f7cab 100644 --- a/ext/docs/websocket_node_kr.md +++ b/ext/docs/websocket_node_kr.md @@ -41,13 +41,13 @@ port: out[0] ports: out[0]: - - name: gateway + - name: upgrader port: io - name: proxy port: io -- kind: gateway - name: gateway +- kind: upgrader + name: upgrader protocol: websocket ports: out: @@ -59,6 +59,6 @@ url: wss://echo.websocket.org/ ports: out: - - name: gateway + - name: upgrader port: in ``` \ No newline at end of file diff --git a/ext/pkg/network/builder.go b/ext/pkg/network/builder.go index 83052ca2..a7518a94 100644 --- a/ext/pkg/network/builder.go +++ b/ext/pkg/network/builder.go @@ -41,7 +41,7 @@ func AddToScheme() scheme.Register { {KindListener, NewListenNodeCodec(), &ListenNodeSpec{}}, {KindRouter, NewRouteNodeCodec(), &RouteNodeSpec{}}, {KindWebSocket, NewWebSocketNodeCodec(), &WebSocketNodeSpec{}}, - {KindGateway, NewGatewayNodeCodec(), &GatewayNodeSpec{}}, + {KindUpgrader, NewUpgradeNodeCodec(), &UpgradeNodeSpec{}}, } for _, def := range definitions { diff --git a/ext/pkg/network/builder_test.go b/ext/pkg/network/builder_test.go index dc3be7e7..8fdaedd1 100644 --- a/ext/pkg/network/builder_test.go +++ b/ext/pkg/network/builder_test.go @@ -42,7 +42,7 @@ func TestAddToScheme(t *testing.T) { err := AddToScheme().AddToScheme(s) assert.NoError(t, err) - tests := []string{KindHTTP, KindListener, KindRouter, KindWebSocket, KindGateway} + tests := []string{KindHTTP, KindListener, KindRouter, KindWebSocket, KindUpgrader} for _, tt := range tests { t.Run(tt, func(t *testing.T) { diff --git a/ext/pkg/network/gateway.go b/ext/pkg/network/upgrader.go similarity index 91% rename from ext/pkg/network/gateway.go rename to ext/pkg/network/upgrader.go index ae81d9b9..79d42935 100644 --- a/ext/pkg/network/gateway.go +++ b/ext/pkg/network/upgrader.go @@ -17,8 +17,8 @@ import ( "github.com/siyul-park/uniflow/pkg/types" ) -// GatewayNodeSpec defines the specifications for creating a GatewayNode. -type GatewayNodeSpec struct { +// UpgradeNodeSpec defines the specifications for creating a UpgradeNode. +type UpgradeNodeSpec struct { spec.Meta `map:",inline"` Protocol string `map:"protocol" validate:"required"` Timeout time.Duration `map:"timeout,omitempty"` @@ -32,13 +32,13 @@ type WebSocketUpgradeNode struct { mu sync.RWMutex } -const KindGateway = "gateway" +const KindUpgrader = "upgrader" var _ node.Node = (*WebSocketUpgradeNode)(nil) -// NewGatewayNodeCodec creates a new codec for GatewayNodeSpec. -func NewGatewayNodeCodec() scheme.Codec { - return scheme.CodecWithType(func(spec *GatewayNodeSpec) (node.Node, error) { +// NewUpgradeNodeCodec creates a new codec for UpgradeNodeSpec. +func NewUpgradeNodeCodec() scheme.Codec { + return scheme.CodecWithType(func(spec *UpgradeNodeSpec) (node.Node, error) { switch spec.Protocol { case ProtocolWebsocket: n := NewWebSocketUpgradeNode() diff --git a/ext/pkg/network/gateway_test.go b/ext/pkg/network/upgrader_test.go similarity index 97% rename from ext/pkg/network/gateway_test.go rename to ext/pkg/network/upgrader_test.go index 1a56c493..8a16393d 100644 --- a/ext/pkg/network/gateway_test.go +++ b/ext/pkg/network/upgrader_test.go @@ -17,10 +17,10 @@ import ( "github.com/stretchr/testify/assert" ) -func TestGatewayNodeCodec_Compile(t *testing.T) { - codec := NewGatewayNodeCodec() +func TestUpgradeNodeCodec_Compile(t *testing.T) { + codec := NewUpgradeNodeCodec() - spec := &GatewayNodeSpec{ + spec := &UpgradeNodeSpec{ Protocol: ProtocolWebsocket, Timeout: time.Second, Buffer: 64,