@@ -185,7 +185,8 @@ func WithLogger(logger *slog.Logger) TappdClientOption {
185185// Creates a new TappdClient instance based on the provided endpoint.
186186// If the endpoint is empty, it will use the simulator endpoint if it is
187187// set in the environment through DSTACK_SIMULATOR_ENDPOINT. Otherwise, it
188- // will use the default endpoint at /var/run/tappd.sock.
188+ // will try /var/run/dstack/tappd.sock first, falling back to /var/run/tappd.sock
189+ // for backward compatibility.
189190func NewTappdClient (opts ... TappdClientOption ) * TappdClient {
190191 client := & TappdClient {
191192 endpoint : "" ,
@@ -218,8 +219,9 @@ func NewTappdClient(opts ...TappdClientOption) *TappdClient {
218219
219220// Returns the appropriate endpoint based on environment and input. If the
220221// endpoint is empty, it will use the simulator endpoint if it is set in the
221- // environment through DSTACK_SIMULATOR_ENDPOINT. Otherwise, it will use the
222- // default endpoint at /var/run/tappd.sock.
222+ // environment through DSTACK_SIMULATOR_ENDPOINT. Otherwise, it will try
223+ // /var/run/dstack/tappd.sock first, falling back to /var/run/tappd.sock
224+ // for backward compatibility.
223225func (c * TappdClient ) getEndpoint () string {
224226 if c .endpoint != "" {
225227 return c .endpoint
@@ -228,7 +230,17 @@ func (c *TappdClient) getEndpoint() string {
228230 c .logger .Info ("using simulator endpoint" , "endpoint" , simEndpoint )
229231 return simEndpoint
230232 }
231- return "/var/run/tappd.sock"
233+ // Try new path first, fall back to old path for backward compatibility
234+ socketPaths := []string {
235+ "/var/run/dstack/tappd.sock" ,
236+ "/var/run/tappd.sock" ,
237+ }
238+ for _ , path := range socketPaths {
239+ if _ , err := os .Stat (path ); err == nil {
240+ return path
241+ }
242+ }
243+ return socketPaths [0 ]
232244}
233245
234246// Sends an RPC request to the Tappd service.
0 commit comments