psisocks.pas

来自「一个delphi的p2p控件的源代码」· PAS 代码 · 共 76 行

PAS
76
字号
unit PsiSocks;

//******************************************************************************
// The original software is under
// Copyright (c) 1993 - 2000, Chad Z. Hower (Kudzu)
//   and the Indy Pit Crew - http://www.nevrona.com/Indy/
//
// Amended : November 2000, by Michael M. Michalak MACS for use with
// MorphTek.com Inc Peer to Peer Open Source Components - http://www.morphtek.com
//
//******************************************************************************

interface

uses
  Classes,
  PsiStack;

type
  TPsiSocksRequest = record
    Version: Byte;
    OpCode: Byte;
    Port: Word;
    IpAddr: TPsiInAddr;
    UserId: String[255];
  end;

  TPsiSocksResponse = record
    Version: Byte;
    OpCode: Byte;
    Port: Word;
    IpAddr: TPsiInAddr;
  end;

  TSocksVersion = (svNoSocks, svSocks4, svSocks4A, svSocks5);
  TSocksAuthentication = (saNoAuthentication, saUsernamePassword);

  TSocksInfo = class(TPersistent)
  protected
    FAuthentication: TSocksAuthentication;
    FHost: string;
    FPassword: string;
    FPort: Integer;
    FUserID: string;
    FVersion: TSocksVersion;
  public
    procedure Assign(Source: TPersistent); override; 
  published
    property Authentication: TSocksAuthentication read FAuthentication write FAuthentication;
    property Host: string read FHost write FHost;
    property Password: string read FPassword write FPassword;
    property Port: Integer read FPort write FPort;
    property UserID: string read FUserID write FUserID;
    property Version: TSocksVersion read FVersion write FVersion;
  end;

implementation

{ TSocksInfo }

procedure TSocksInfo.Assign(Source: TPersistent);
begin
  if Source is TSocksInfo then
     with Source as TSocksInfo do begin
       Self.Authentication := Authentication;
       Self.Host := Host;
       Self.Password := Password;
       Self.Port := Port;
       Self.UserID := UserID;
       Self.Version := Version;
   end
   else inherited;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?