go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/logdog/client/butlerlib/streamproto/magic.go (about)

     1  // Copyright 2015 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package streamproto
    16  
    17  var (
    18  	// ProtocolFrameHeaderMagic is the number at the beginning of streams that
    19  	// identifies the stream handshake version.
    20  	//
    21  	// This serves two purposes:
    22  	//   - To disambiguate a Butler stream from some happenstance string of bytes
    23  	//     (which probably won't start with these characters).
    24  	//   - To allow an upgrade to the wire format, if one is ever needed. e.g.,
    25  	//     a switch to something other than recordio/JSON.
    26  	ProtocolFrameHeaderMagic = []byte("BTLR1\x1E")
    27  )
    28  
    29  // LocalNamedPipePath returns the path to a local Windows named pipe named
    30  // `base`. This is used with the 'net.pipe' butler protocol.
    31  func LocalNamedPipePath(base string) string {
    32  	return `\\.\pipe\` + base
    33  }