Files
protocol/utils/id.go
Dan McFaul fdacb1a293 add cloud agents (#1010)
* initial commit

* add agent hosting types

* generated protobuf

* Update auth/grants.go

Co-authored-by: David Zhao <dz@livekit.io>

* Update protobufs/livekit_cloud_agent.proto

Co-authored-by: David Zhao <dz@livekit.io>

* dz feedback

* rebase fixes

* match ListAgents func call

* generated protobuf

* update regional_agents to agent_deployments

* generated protobuf

* add client settings endpoint

* generated protobuf

* Create changeset

* fix changeset

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Zhao <dz@livekit.io>
2025-03-19 10:50:56 -06:00

70 lines
2.2 KiB
Go

// Copyright 2023 LiveKit, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package utils
import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils/guid"
)
const (
GuidSize = guid.Size
)
const (
RoomPrefix = guid.RoomPrefix
NodePrefix = guid.NodePrefix
ParticipantPrefix = guid.ParticipantPrefix
TrackPrefix = guid.TrackPrefix
APIKeyPrefix = guid.APIKeyPrefix
EgressPrefix = guid.EgressPrefix
IngressPrefix = guid.IngressPrefix
SIPTrunkPrefix = guid.SIPTrunkPrefix
SIPDispatchRulePrefix = guid.SIPDispatchRulePrefix
SIPCallPrefix = guid.SIPCallPrefix
RPCPrefix = guid.RPCPrefix
WHIPResourcePrefix = guid.WHIPResourcePrefix
RTMPResourcePrefix = guid.RTMPResourcePrefix
URLResourcePrefix = guid.URLResourcePrefix
AgentWorkerPrefix = guid.AgentWorkerPrefix
AgentJobPrefix = guid.AgentJobPrefix
AgentDispatchPrefix = guid.AgentDispatchPrefix
HostedAgentPrefix = guid.HostedAgentPrefix
HostedAgentRegionPrefix = guid.HostedAgentRegionPrefix
HostedAgentVersionPrefix = guid.HostedAgentVersionPrefix
HostedAgentSecretPrefix = guid.HostedAgentSecretPrefix
)
func NewGuid(prefix string) string {
return guid.New(prefix)
}
// HashedID creates a hashed ID from a unique string
func HashedID(id string) string {
return guid.HashedID(id)
}
func LocalNodeID() (string, error) {
return guid.LocalNodeID()
}
func MarshalGuid[T livekit.Guid](id T) livekit.GuidBlock {
return guid.Marshal(id)
}
func UnmarshalGuid[T livekit.Guid](b livekit.GuidBlock) T {
return guid.Unmarshal[T](b)
}