Skip to content

Commit

Permalink
feat(transport): add endpoint option for server (#2904)
Browse files Browse the repository at this point in the history
  • Loading branch information
youzhixiaomutou committed Jul 6, 2023
1 parent 32b1d13 commit bffc1a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions transport/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ func Address(addr string) ServerOption {
}
}

// Endpoint with server address.
func Endpoint(endpoint *url.URL) ServerOption {
return func(s *Server) {
s.endpoint = endpoint
}
}

// Timeout with server timeout.
func Timeout(timeout time.Duration) ServerOption {
return func(s *Server) {
Expand Down
7 changes: 7 additions & 0 deletions transport/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ func Address(addr string) ServerOption {
}
}

// Endpoint with server address.
func Endpoint(endpoint *url.URL) ServerOption {
return func(s *Server) {
s.endpoint = endpoint
}
}

// Timeout with server timeout.
func Timeout(timeout time.Duration) ServerOption {
return func(s *Server) {
Expand Down

0 comments on commit bffc1a0

Please sign in to comment.